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

293
Vistas
why get 413 error when upload image with 'expo ImagePicker camera'?

If I take a photo with the camera, I get this error: Error: Request failed with status code 413.

But if I select and upload a photo from the phone gallery, there will be no problem. The size of the photo I upload was below 5mb both with the camera and with the gallery.

const formData = new FormData();

    let localUri = image.value.uri;
    let filename = localUri.split('/').pop();
    let type = mime.getType(localUri);

    image.blob &&
      formData.append('photo', { uri: localUri, name: filename, type });


const pickImageFromGallery = async () => {
    let result = await ImagePicker.launchImageLibraryAsync({
      mediaTypes: ImagePicker.MediaTypeOptions.Images,
      allowsEditing: true,
      aspect: [16, 9],
      base64: true,
    });

    if (!result.cancelled) {
      const response = await fetch(result.uri);
      const blob = await response.blob();
      if (blob.size && blob.size / 1024 < 5120) {
        setImage({
          value: result,
          blob: blob,
          error: false,
        });
      } else {
        alert('File size is too large. Please upload files below 5MB!');
      }
    }
  };

const pickImageFromCamera = async () => {
    let result = await ImagePicker.launchCameraAsync({
      mediaTypes: ImagePicker.MediaTypeOptions.Images,
      allowsEditing: true,
      aspect: [16, 9],
      base64: true,
    });

    if (!result.cancelled) {
      const response = await fetch(result.uri);
      const blob = await response.blob();

      if (blob.size && blob.size / 1024 < 5120) {
        setImage({
          value: result,
          blob: blob,
          error: false,
        });
      } else {
        alert('File size is too large. Please upload files below 5MB!');
      }
    }
  };
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