mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR Moved defined variables in AssetAdmin::doUpload() to the top of the method for consistency (from r96230)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@102468 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ea5d386c68
commit
0624cc69ed
@ -147,6 +147,13 @@ JS
|
||||
*/
|
||||
function doUpload($data, $form) {
|
||||
$processedFiles = array();
|
||||
$newFiles = array();
|
||||
$fileIDs = array();
|
||||
$fileNames = array();
|
||||
$fileSizeWarnings = '';
|
||||
$errorsArr = '';
|
||||
$status = '';
|
||||
$statusMessage = '';
|
||||
|
||||
if(!isset($data['Files'])) return Director::set_status_code("404");
|
||||
|
||||
@ -157,25 +164,17 @@ JS
|
||||
$processedFiles[$key][$param] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$proccessedFiles[] = $data['Files'];
|
||||
}
|
||||
|
||||
// get the folder to upload to.
|
||||
if(isset($data['FolderID']) && $data['FolderID'] != "root") {
|
||||
$folder = DataObject::get_by_id('Folder', $data['FolderID']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$folder = DataObject::get_one('Folder');
|
||||
}
|
||||
|
||||
$newFiles = array();
|
||||
$fileSizeWarnings = '';
|
||||
$errorsArr = '';
|
||||
$status = '';
|
||||
$statusMessage = '';
|
||||
|
||||
foreach($processedFiles as $tmpFile) {
|
||||
if($tmpFile['error'] == UPLOAD_ERR_NO_TMP_DIR) {
|
||||
$errorsArr[] = _t('AssetAdmin.NOTEMP', 'There is no temporary folder for uploads. Please set upload_tmp_dir in php.ini.');
|
||||
@ -210,7 +209,7 @@ JS
|
||||
|
||||
if($newFiles) {
|
||||
$numFiles = sizeof($newFiles);
|
||||
$statusMessage = sprintf(_t('AssetAdmin.UPLOADEDX',"Uploaded %s files"),$numFiles) ;
|
||||
$statusMessage = sprintf(_t('AssetAdmin.UPLOADEDX',"Uploaded %s files"),$numFiles);
|
||||
$status = "good";
|
||||
} else if($errorsArr) {
|
||||
$statusMessage = implode('\n', $errorsArr);
|
||||
@ -220,8 +219,6 @@ JS
|
||||
$status = "";
|
||||
}
|
||||
|
||||
$fileIDs = array();
|
||||
$fileNames = array();
|
||||
foreach($newFiles as $newFile) {
|
||||
$fileIDs[] = $newFile;
|
||||
$fileObj = DataObject::get_one('File', "\"File\".\"ID\"=$newFile");
|
||||
|
Loading…
Reference in New Issue
Block a user