Skip to content

Commit e183803

Browse files
authored
Merge pull request #454 from cuonghuynh/write-log-upload-file-exception
Writing to the log with upload file exception by @cuonghuynh
2 parents 7c61ed1 + 32e4505 commit e183803

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/controllers/UploadController.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Unisharp\Laravelfilemanager\controllers;
44

55
use Illuminate\Support\Facades\File;
6+
use Illuminate\Support\Facades\Log;
67
use Intervention\Image\Facades\Image;
78
use Symfony\Component\HttpFoundation\File\UploadedFile;
89
use Unisharp\Laravelfilemanager\Events\ImageIsUploading;
@@ -83,7 +84,13 @@ private function proceedSingleUpload($file)
8384
chmod($new_file_path, config('lfm.create_file_mode', 0644));
8485
} catch (\Exception $e) {
8586
array_push($this->errors, parent::error('invalid'));
86-
// FIXME: Exception must be logged.
87+
88+
Log::error($e->getMessage(), [
89+
'file' => $e->getFile(),
90+
'line' => $e->getLine(),
91+
'trace' => $e->getTraceAsString()
92+
]);
93+
8794
return false;
8895
}
8996

0 commit comments

Comments
 (0)