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