I have made a post mapping in spring boot to pass all the field values of my pojo from form-data of postman
.
One of the fields involves uploading a file which is handled by multipartfile.
I am getting an internal server error in postman when running this method
@RequestMapping(method=RequestMethod.POST,value="/upload/{jobID}")
public Application upload(@RequestParam("file") MultipartFile file,@PathVariable String jobID,
@RequestParam("name") String name,@RequestParam("emailId") String emailId,
@RequestParam("applicationStatus") ApplicationStatus applicationStatus) throws IOException {
Offer offer=offerRepository.findById(jobID).get();
Application application=new Application();
System.out.println(file.getContentType());
System.out.println(file.getOriginalFilename());
System.out.println(file.getSize());
application.setApplicationStatus(ApplicationStatus.valueOf("APPLIED"));
application.setResume(file.getBytes());
application.getMykey().setOffer(offer);
return applicationRepository.save(application);
}
and here is the detailed error
{
"timestamp": "2018-10-15T17:31:31.346+0000",
"status": 500,
"error": "Internal Server Error",
"message": "No message available",
"path": "/api/upload/SE"
}