From ee1f983114bdc78cae97296d83cc35b3b62fc015 Mon Sep 17 00:00:00 2001 From: Daniel Meltzer Date: Mon, 27 Jun 2016 23:37:15 -0400 Subject: [PATCH] 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. --- app/Http/Controllers/AssetsController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index d79c37e3ff..9f1396120e 100755 --- a/app/Http/Controllers/AssetsController.php +++ b/app/Http/Controllers/AssetsController.php @@ -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; }