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

184
Views
Empty image when uploading to presigned AWS S3 url in React Native

I'm trying to upload image to AWS S3 in my React Native(expo managed workflow), but in result the file is empty. I don't get any errors through the process. I've also tried to upload it using Uppy AWS plugin, but result is the same. Here is my code:

async function getUploadUrl(filename: string, type: string) {
  const response = await fetch(GET_UPLOAD_URL(filename, type), {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json',
      Accept: 'application/json',
    },
  });
  return await response.json();
}


export default async function uploadImage(
  file: Blob,
  filename: string,
  base64: string
) {
  const uploadData = await getUploadUrl(filename, file.type);

  const data = new FormData();
  for (const [key, value] of Object.entries(uploadData.fields)) {
    data.append(key, value as string);
  }
  data.append('file', Buffer.from(base64, 'base64'));
  let res = await fetch(uploadData.url, {
    method: 'post',
    body: data,
    headers: {
      'Content-Type': 'multipart/form-data;',
    },
  });

I am using expo image picker to get the file. I've also tried to upload just Blob file insead of Buffer, but it doesn't work either

Here is how the file looks if i open it in browser https://prnt.sc/vOk5CI7lyPhu

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If anyone also faced such problem, i managed to upload the file by uri like this:

formData.append('file', {
    uri: uri,
    type: 'image/jpeg',
    name: filename,
  });
about 4 years ago · Juan Pablo Isaza Report
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!