1
I’m using Laravel 5.3 and sending images to Amazon S3.
I have already put the rules in Bucket so that it is public and I am sending the image as follows:
request()->file('avatar')->storeAs('uploads/143', 'avatar.jpg', 's3');
The file is being sent normally to S3 but does not send with the correct mimetype. In the above example the file mimetype would be image/jpeg
but when viewing directly by Amazon S3 panel the file is with mimetype application/octet-stream
This makes the file, when accessed, open the browser save (download) window and does not simply display the file as expected.
I couldn’t find a way to set mimetype or fix it in Bucket settings.
It seems that it is not Laravel’s problem to "send the mime" wrong, but the answer you get from Amazon is with this header.
– Wallace Maxters
Have you tried the test before the upload,
request()->file('avatar')->getClientMimeType()
?– Wallace Maxters
Already yes, in Laravel is exhibiting with Mimetype right. Then I send and go to the Amazon console to click and see the image in the browser but then it opens for download.
– rodrigoum
So really, it seems to be setting on Amazon
– Wallace Maxters
If I send the file directly through the Amazon console mimetype is normal (image/jpeg) but not by Laravel.
– rodrigoum
You could open a Github Issue by reporting this problem! https://github.com/laravel/laravel
– novic