I’m uploading an image in Amazon s3 but when I try to view the file in the browser it lets me download the image, how would I disable that one? My expected outcome should be seeing the image in the browser. How would I do that one?
I heard something of setting the header but I’m not familiar with that on.
Can someone teach me how to accomplish this one.
Thanks!
Anyhelp would be greatly appreciated and rewarded.
Are you using the AWS SDK for PHP?
You need to set the correct
Content-Typefor your image, otherwise the default isapplication/octet-streamwhich is why your browser downloads the file. There’s a good listing of values on wikipedia.Or for existing objects in S3, you can use
change_content_typeFinally, if you are generating pre-signed urls, you can dynamically set the
content-type.