0

I am trying to create a REST endpoint in Liferay for files upload, but ActionRequest cannot be used. When I try to use it I keep getting:

Handler execution resulted in exception: Required MultipartFile parameter 'file' is not present resourceId:personUpload

My Controller:

@ResourceMapping(value = "personUpload")
public List<ChInsuredPerson> uploadExcel(@RequestParam("file") MultipartFile file, HttpServletResponse response) throws Exception {

    List<ChInsuredPerson> insuredPeople = new ArrayList<ChInsuredPerson>();
    try {
        insuredPeople = personUploadService.extractInsuredPersons(file.getInputStream());
    } catch (IllegalStateException e) {
        response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    }

    return insuredPeople;

}

I am calling the endpoint with Postman like this: enter image description here

user3048782
  • 61
  • 1
  • 1
  • 6

0 Answers0