Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

381
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda