Boris56's avatar

Image upload as corrupted

Hi,

I upload a file on storage, this doing well but the file uploaded is corrupted.

Impossible to open the file.

Any idea? Thank you.

The code:

$media = new Media();
$file = $request->file('media');

$media->filename = $file->getClientOriginalName();
$media->extension = $file->getClientOriginalExtension();
$media->mime_type = $file->getClientMimeType();
$media->size = $file->getSize();

$media->save();
Storage::put($media->filename . '.' . $media->extension, $file);
0 likes
1 reply

Please or to participate in this conversation.