How to display s3 image in the browser, now it is getting downloading every time when I try to open it in a browser. I have set the content type but still, I am facing the same issue. here is my code
var params = {
Key: 'upload/' + req.file.originalname,
Body: data,
ContentType:'image/jpeg',
ACL: 'public-read'
};
s3bucket.upload(params, function(err, aws_images) {
console.log(aws_images)
})
It appears that you are wanting to have images served from Amazon S3 cached in browsers.
To do this, you can set cache-control
metadata on the objects.
See: