From: Vincent Vanwaelscappel Date: Thu, 14 Oct 2021 17:07:47 +0000 (+0200) Subject: wip #4791 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=27f182255c13417263424189834b4c9aac66d1fc;p=cubist_cms-back.git wip #4791 @0.5 --- diff --git a/src/app/Magic/Controllers/CubistMagicController.php b/src/app/Magic/Controllers/CubistMagicController.php index 38b462f..c40993f 100644 --- a/src/app/Magic/Controllers/CubistMagicController.php +++ b/src/app/Magic/Controllers/CubistMagicController.php @@ -361,12 +361,8 @@ class CubistMagicController extends CubistCrudController /** @var Media $media */ /** @var UploadedFile $file */ $file = request()->files->get('file'); - $e = explode('.', $file->getFilename()); - $ext = array_pop($e); - $fname = implode('.', $e); - $fname = Str::slug($fname); - $nfile = new UploadedFile($file->getPathname(), $fname . '.' . $ext, $file->getMimeType(), $file->getError()); + $nfile = new UploadedFile($file->getPathname(), Str::slug($file->getClientOriginalName()) . '.' . $file->getClientOriginalExtension(), $file->getMimeType(), $file->getError()); request()->files->set('file', $nfile); $media = $entry->addMediaFromRequest('file')->toMediaCollection($request->input('collection'));