I am trying to upload files to aws S3 storage.
strImage = a.replace(/^data:image\/[a-z]+;base64,/, ""); //base64 replace code
s3.upload({
Bucket : albumBucketName,
Key: 'test.jpeg',
Body: strImage,
//ACL : 'public-read',
ContentEncoding: 'base64',
ContentType: 'image/jpeg'
}, function (err, data) {
if (err) {
return alert('There was an error uploading your photo: ', err.message);
}
alert('Successfully uploaded photo.');
});
The file is uploaded correctly,but when data is a base64 encoded string, which is image data, the File is uploaded but image is collaphed.
How can do it JavaScript?
Also, even if you give all the users to read and proceed, the 400 Error will appear if you set the ACL to public-read.