If the move of the uploaded import file fails, return a message. Fixes an issue reported on gitter today where bad permissions on the upload directory didn't provide any feedback.

This commit is contained in:
Daniel Meltzer 2016-06-27 23:37:15 -04:00
parent e9bb0e948b
commit ee1f983114

View file

@ -836,7 +836,12 @@ class AssetsController extends Controller
$date = date('Y-m-d-his');
$fixed_filename = str_replace(' ', '-', $file->getClientOriginalName());
try {
$file->move($path, $date.'-'.$fixed_filename);
} catch (\Symfony\Component\HttpFoundation\File\Exception\FileException $exception) {
$results['error']=trans('admin/hardware/message.upload.error');
return $results;
}
$name = date('Y-m-d-his').'-'.$fixed_filename;
$filesize = Setting::fileSizeConvert(filesize($path.'/'.$name));
$results[] = compact('name', 'filesize');
@ -850,7 +855,6 @@ class AssetsController extends Controller
} else {
$results['error']=trans('general.feature_disabled');
return $results;
}