Just a hunch, but ... docx, xlsx, pptx, etc are zip files.. so if you're detecting the mime type automagically, it's probably seeing the zip header in the file and treating it accordingly, you may have to explicitly define the mime type instead of detecting the mime type. Try getClientMimeType() instead of getMimeType might be more reliable
Apr 14, 2020
1
Level 1
S3 File Upload Issue
Hello everyone,
I am facing a strange issue with laravel file upload, I am uploading all types of media file and everything works fine, but when I upload a ppt or pptx file laravel converts it to zip by itself and uploads to the specified disk.
I have tried both S3 and public disks and the behaviour is same. Below is the code snippet that I am using -
$response = Storage::disk('s3')->put('folder_name', $request->fileData , [ 'visibility' => 'public', 'ContentType' => $request->fileData->getMimeType() ]);
Thanks in advance for the help.
Please or to participate in this conversation.