我正在尝试在Liferay中创建用于文件上传的REST端点,但不能使用ActionRequest。当我尝试使用它时,我一直得到:
Handler execution resulted in exception: Required MultipartFile parameter 'file' is not present resourceId:personUpload
我的控制器:
@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;
}