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

376
Vistas
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
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