stevenH
stevenH

Reputation: 175

How can I upload image to s3 with Multer buffer?

I'm using the Multer library to upload an image. So, I use ReactJS to upload the file to the NodeJS server. In the NodeJS server, I received a piece of image information sent from the client as this picture.

enter image description here

In the s3 upload function, I use the buffer value in this picture as a body. I uploaded it to s3 successfully but when I open the image URL, it shows me like this picture.

enter image description here

There's any suggestion or correct way to upload an image to S3.

Upvotes: 2

Views: 1473

Answers (1)

Joan Albert
Joan Albert

Reputation: 665

I would suggest you to use base64 encoding, 7bit enconding won't work for images as you are trying to do.

You can read more about that in this StackOverflow answer: https://stackoverflow.com/a/28531705/6334411

Upvotes: 1

Related Questions