0

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)
})
John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Schüler
  • 512
  • 4
  • 10
  • 25

1 Answers1

0

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:

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470