Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

424
Views
Uploading base64 encoded image to aws s3 via javascript

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!