mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
#1523 - Error when attaching files to pages without having specified a file
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@43922 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
bdf74e499f
commit
20e79f33be
@ -623,10 +623,21 @@ class Image_Uploader extends Controller {
|
||||
* Save the data in this form.
|
||||
*/
|
||||
function save($data, $form) {
|
||||
if($data['Upload']['size'] == 0) {
|
||||
// No image has been uploaded
|
||||
Director::redirectBack();
|
||||
return;
|
||||
}
|
||||
$owner = DataObject::get_by_id($data['Class'], $data['ID']);
|
||||
$fieldName = $data['Field'] . 'ID';
|
||||
|
||||
if($data['ImageSource'] == 'existing') {
|
||||
if(!$data['ExistingFile']) {
|
||||
// No image has been selected
|
||||
Director::redirectBack();
|
||||
return;
|
||||
}
|
||||
|
||||
$owner->$fieldName = $data['ExistingFile'];
|
||||
|
||||
// Edit the class name, if applicable
|
||||
|
Loading…
x
Reference in New Issue
Block a user