I’m trying to upload a jpeg file from within node. I’m using a library to generate a jpeg image, if that changes anything. I’m able to download the generated image from my app and open it just fine, but when I upload it to Spaces, it opens as a little gray square.
I’m using Upload from ‘@aws-sdk/lib-storage’. I’m setting my params like this:
const params = {
Bucket: 'somename',
Key: `user_thumbnails/${id}.jpeg`,
Body: image,
ACL: 'public-read',
ContentType: 'image/jpeg',
};
I’m uploading it like this:
const parallelUploads3 = new Upload({
client: s3Client,
params,
});
parallelUploads3.on('httpUploadProgress', (progress) => {
console.log('upload progress', progress);
});
await parallelUploads3.done();
The upload is completing, but like I said, I’m unable to view the image.
Some added information if you’re curious: I’m using dom-to-image to create the image. If I use file-saver to download the image directly, it works just fine, so I don’t think there is an issue with the image itself.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!