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;
}