MINOR Better error checking in AssetAdmin->doUpload() (AIR-41)

This commit is contained in:
Ingo Schommer 2011-08-29 08:59:58 +02:00
parent aa1ce1af39
commit 88cbd4605e

View File

@ -209,8 +209,12 @@ JS
}
$processedData = array_reverse($processedData);
if($data['FolderID'] && $data['FolderID'] != '') $folder = DataObject::get_by_id("Folder", $data['FolderID']);
else $folder = singleton('Folder');
if($data['FolderID'] && $data['FolderID'] != '') {
$folder = DataObject::get_by_id("Folder", $data['FolderID']);
if(!$folder) throw new InvalidArgumentException(sprintf("Folder #%d doesn't exist", (int)$data['FolderID']));
} else {
$folder = singleton('Folder');
}
foreach($processedFiles as $filePostId => $tmpFile) {
if($tmpFile['error'] == UPLOAD_ERR_NO_TMP_DIR) {