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

489
Views
EXPO React Native - AXIOS + FORMDATA PROBLEM

i have an issue with POST request inside my app.

part of code :

if (imagesResults !== undefined) {
  imagesResults.forEach((el) => {
    let localUri = el.uri;
    let filename = localUri.split("/").pop();

    let match = /\.(\w+)$/.exec(filename);
    let type = match ? `image/${match[1]}` : `image`;
    formData.append("saleImages[]", {
      uri: localUri,
      name: filename,
      type: type,
    });
  });
}

console.log("FORMDATA", formData);

const axiosConfig = {
  headers: {
    Authorization: "Bearer  " + user.token,
    "content-type": "application/x-www-form-urlencoded",
    Accept: "application/json",
  },
};

try {
  axios
    .post(`${API}/sales/${saleId}/edit`, formData, axiosConfig)
    .then((res) => {
      // console.log("RES", JSON.stringify(res.data));
      bottomSheetRef.current.snapToIndex(0);
      setTimeout(() => {
        bottomSheetRef.current.close();
        dispatch(setLoadingApiAction(false));
        navigation.navigate("My Ads");
      }, 3000);
    })
    .catch((err) => {
      console.log("error", err);
      // setErrors(err.response.data.errors);
      navigation.navigate("My Ads");
      alert("SOMETHING IS WRONG!");
      dispatch(setLoadingApiAction(false));
    });
} catch (error) {
  console.log("ERROR CATCH", error);
  dispatch(setLoadingApiAction(false));
 }
};

so what is happening, i fire my API, and i get 200 but just after i get 200 it return me also a network error and goes into .catch part.

This is only happening in ANDROID DEVICE , IOS working totally fine.

I am using a HTTPS , also i tried to set type of the image hardcoded into "image/jpeg" but i got the same problem.

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!