mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-24 04:03:34 -08:00
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:
parent
e9bb0e948b
commit
ee1f983114
|
@ -836,7 +836,12 @@ class AssetsController extends Controller
|
|||
|
||||
$date = date('Y-m-d-his');
|
||||
$fixed_filename = str_replace(' ', '-', $file->getClientOriginalName());
|
||||
$file->move($path, $date.'-'.$fixed_filename);
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue