mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FileIFrame Saving method problem fixing
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@43542 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c485a70354
commit
0a85936f2f
@ -25,5 +25,21 @@ class FileIFrameField extends FileField {
|
|||||||
return FormField::Field();
|
return FormField::Field();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function saveInto(DataObject $record) {
|
||||||
|
$fieldName = $this->name . 'ID';
|
||||||
|
$hasOnes = $record->has_one($this->name);
|
||||||
|
if(!$hasOnes) $hasOnes = $record->has_one($fieldName);
|
||||||
|
|
||||||
|
// assume that the file is connected via a has-one
|
||||||
|
if( !$hasOnes || !$_FILES[$this->name]['name']){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = new File();
|
||||||
|
$file->loadUploaded($_FILES[$this->name]);
|
||||||
|
|
||||||
|
$record->$fieldName = $file->ID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
x
Reference in New Issue
Block a user