mirror of
https://github.com/axeloz/filesharing.git
synced 2025-05-06 18:13:55 +02:00
Errors when storing uploaded files weren't raised.
This commit is contained in:
parent
2fdca6b0c7
commit
9d71927485
1 changed files with 6 additions and 1 deletions
|
@ -55,7 +55,7 @@ class UploadController extends Controller
|
||||||
|
|
||||||
// Generating the file name
|
// Generating the file name
|
||||||
$original = $request->file->getClientOriginalName();
|
$original = $request->file->getClientOriginalName();
|
||||||
$filename = substr(sha1($original.time()), 0, rand(20, 30));
|
$filename = substr(sha1($original.time()), 0, mt_rand(20, 30));
|
||||||
|
|
||||||
// Moving file to final destination
|
// Moving file to final destination
|
||||||
try {
|
try {
|
||||||
|
@ -72,6 +72,11 @@ class UploadController extends Controller
|
||||||
$fullpath = $request->file('file')->storeAs(
|
$fullpath = $request->file('file')->storeAs(
|
||||||
$bundle->slug, $filename, 'uploads'
|
$bundle->slug, $filename, 'uploads'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (false === $fullpath) {
|
||||||
|
throw new Exception('An error occurred while storing the file');
|
||||||
|
}
|
||||||
|
|
||||||
// Generating file metadata
|
// Generating file metadata
|
||||||
$file = new File([
|
$file = new File([
|
||||||
'uuid' => $request->uuid,
|
'uuid' => $request->uuid,
|
||||||
|
|
Loading…
Add table
Reference in a new issue