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

1K
Vistas
SpringBoot simple multipart file upload with Advanced rest client (Chrome)

I want to upload a image to the file system. So I am using Multi-part file upload with spring boot. And also I am using Advance Rest Client(Chrome) tool to POST Multi part file. But I am facing an error even I do not specify any content type org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found.

Here my rest controller code,

@RestController
public class StringController {
@RequestMapping(value="/upload", method=RequestMethod.POST)
public @ResponseBody String singleSave(@RequestParam("file") MultipartFile file){

    String fileName = null;
    if (!file.isEmpty()) {
        try {
            fileName = file.getOriginalFilename();
            byte[] bytes = file.getBytes();
            BufferedOutputStream buffStream = 
                    new BufferedOutputStream(new FileOutputStream(new File("F:/" + fileName)));
            buffStream.write(bytes);
            buffStream.close();
            return "You have successfully uploaded " + fileName;
        } catch (Exception e) {
            return "You failed to upload " + fileName + ": " + e.getMessage();
        }
    } else {
        return "Unable to upload. File is empty.";
    }
  }
}

Screenshot (Advance rest client tool)

enter image description here

Error

{ "timestamp": 1490678908517, "status": 500, "error": "Internal Server Error", "exception": "org.springframework.web.multipart.MultipartException", "message": "Could not parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found", "path": "/upload" }

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

The problem is in your request from advance rest client. It is working fine in the postman.The image is getting uploaded. Try with postman you will get it.

over 4 years ago · Santiago Trujillo Denunciar

0

You lost in you client request headers value boundary. Construct in PostMan header "Content-Type" like this:

Content-Type : multipart/form-data;boundary="12312313132132"
over 4 years ago · Santiago Trujillo Denunciar
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