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

280
Views
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
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!