Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

195
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda