I have a photo uploader using SWFUpload to insert images into a Photo DataObject. See code below:
public function addPhotos($data,$form)
{
if(isset($data['uploaded_files']) && is_array($data['uploaded_files']) && isset($data['AlbumID'])) {
foreach($data['uploaded_files'] as $id) {
$p = new Photo();
$p->AlbumID = $data['AlbumID'];
$p->MemberPageID = $this->Member()->MemberPageID;
$p->ImageID = $id;
$p->write();
}
Director::redirectBack();
return;
}
}
The problem is that the ImageID does not get written to its own column in the Photo database table. The File class gets created just fine, the file appears in the assets/Uploads folder. I even echoed $id to find out if it was being passed at all, and yes it is.
I'm stumped.