/**
* 获取文件列表从request中
*
* @param request
* @return
*/
private List getMutipartFileForRequet(HttpServletRequest request) {
List files = new ArrayList<>();
CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver(request.getSession().getServletContext());
commonsMultipartResolver.setDefaultEncoding("utf-8");
if (commonsMultipartResolver.isMultipart(request)) {
MultipartHttpServletRequest mulReq = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> map = mulReq.getFileMap();
// key为前端的name属性,value为上传的对象(MultipartFile)
for (Map.Entry<String, MultipartFile> entry : map.entrySet()) {
files.add(entry.getValue());
}
}
return files;
}