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

379
Views
How to upload the image from react native to java spring boot?

I need to upload my datas from the frontend(react native mobile app) to the backend created using java spring boot. How i have done is by passing the params in the FormData like

 let formData = new FormData();
 let frontFile = { name:"file1",type:"image/png",uri:"<URI path of the image">}
 let referenceNum = 12;

 formData.append("file1", frontFile);
 formData.append("referenceNum",referenceNum);

 const config = {
  headers: {
    'Content-Type': 'multipart/form-data',
    Accept: 'application/json',
  },
};

 axios
  .post(
    'MY API endpoint',
    formData,
     config,
   )
   .then((response) => console.log(response))
   .catch((errors) => console.log(errors));

When try to do like this, it shows error like

Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.web.multipart.MultipartFile' for property 'backFile'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'org.springframework.web.multipart.MultipartFile' for property 'backFile': no matching editors or conversion strategy found

Note: The backend expects my data to always be multi-part type,but what the actual data sent to the server is [object object].It always shows type error. Any idea how to solve this issue?

enter image description here

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!