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

307
Vistas
Fetch TypeError: Network request failed React Native

I try do the next fetch with react-native android 12 API 28

(import FormData from 'form-data';)

   let formData = new FormData();
        const file = new File(["foo"], "foo.txt",
            "text/plain",
        );

   let textFile = {
         uri: file.uri,
            name: "foo.txt",
            type: "text/plain"
        };

        formData.append("photo", textFile);
        formData.append('description', 'helli');

fetch(url, {
            method: 'post',
            headers: formData.getHeaders,
            body: formData
        }).then(response => {
            console.log("image uploaded")
        }).catch(err => {
            console.log(err)
        })

y Try with localhost (http) and heroku (https) but it does not work

The Error is: [TypeError: Network request failed]

the description field is fine but the file appears as null

about 4 years ago · Juan Pablo Isaza
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