// 转型为MultipartHttpRequest:
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
// 获得文件:
MultipartFile file = multipartRequest.getFile("filename"); //filename表单参数名
if(MyStringUtil.isEmptyOrNullAfterTrim(file.getOriginalFilename())){
throw new RuntimeException("上传文件不能为空");
}
FileCopyUtils.copy(file.getBytes(), objectFile);