I'm trying to get string value from form-data in the Post method in Spring.
I'm getting a bad request error.
@SuppressWarnings("unchecked")
@RequestMapping(value = "/formdataValueGet", method = RequestMethod.POST, consumes = {"multipart/form-data"})
public ResponseEntity<Map<String, Object>> formdataValueGet(HttpServletRequest request, @RequestParam("file") String file) throws Exception{
System.out.println("Api hit file upload");
Map<String, Object> params = new HashMap<String, Object>();
System.out.println("Map issue");
try{
params.put("error", "Failed to make payment");
return new ResponseEntity<Map<String, Object>>(params, HttpStatus.OK);
}catch(Exception ae){
params.put("error", "Failed to make payment");
return new ResponseEntity<Map<String, Object>>(params, HttpStatus.OK);
}
}