Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

185
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda