- IndexController.php: create unique file names: using uuid() instead of time()
This commit is contained in:
parent
2bf8cb82b5
commit
65e581892f
|
@ -22,6 +22,7 @@ use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class IndexController extends Controller
|
class IndexController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -340,7 +341,8 @@ class IndexController extends Controller
|
||||||
$file = $uploadedFile['file'];
|
$file = $uploadedFile['file'];
|
||||||
$label = urldecode($uploadedFile['label']);
|
$label = urldecode($uploadedFile['label']);
|
||||||
$sorting = $uploadedFile['sorting'];
|
$sorting = $uploadedFile['sorting'];
|
||||||
$fileName = "file-" . time() . '.' . $file->getClientOriginalExtension();
|
// $fileName = "file-" . time() . '.' . $file->getClientOriginalExtension();
|
||||||
|
$fileName = "file-" . Str::uuid()->toString() . '.' . $file->getClientOriginalExtension();
|
||||||
$mimeType = $file->getMimeType();
|
$mimeType = $file->getMimeType();
|
||||||
$datasetFolder = 'files/' . $dataset->id;
|
$datasetFolder = 'files/' . $dataset->id;
|
||||||
$path = $file->storeAs($datasetFolder, $fileName);
|
$path = $file->storeAs($datasetFolder, $fileName);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user