mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
MINOR Checking for success of file upload before trying to add metadata in AssetAdmin->doUpload() (AIR-37)
This commit is contained in:
parent
6b9b0ef161
commit
d81f882b4f
@ -255,17 +255,17 @@ JS
|
|||||||
|
|
||||||
// move file to given folder
|
// move file to given folder
|
||||||
if($valid) {
|
if($valid) {
|
||||||
$newFile = $folder->addUploadToFolder($tmpFile);
|
if($newFile = $folder->addUploadToFolder($tmpFile)) {
|
||||||
|
if(self::$metadata_upload_enabled && isset($processedData[$filePostId])) {
|
||||||
if(self::$metadata_upload_enabled && isset($processedData[$filePostId])) {
|
$fileObject = DataObject::get_by_id('File', $newFile);
|
||||||
$fileObject = DataObject::get_by_id('File', $newFile);
|
$metadataForm = new Form($this, 'MetadataForm', $fileObject->uploadMetadataFields(), new FieldSet());
|
||||||
$metadataForm = new Form($this, 'MetadataForm', $fileObject->uploadMetadataFields(), new FieldSet());
|
$metadataForm->loadDataFrom($processedData[$filePostId]);
|
||||||
$metadataForm->loadDataFrom($processedData[$filePostId]);
|
$metadataForm->saveInto($fileObject);
|
||||||
$metadataForm->saveInto($fileObject);
|
$fileObject->write();
|
||||||
$fileObject->write();
|
}
|
||||||
|
|
||||||
|
$newFiles[] = $newFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newFiles[] = $newFile;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user