spring mvc接口参数有文件类型,同时包含键值对,后台可以使用以下方法来接收参数
1.前端传递方式
2.接收接口
@RequestMapping(value = "/uploadGPS", method = RequestMethod.POST)
@ResponseBody
public Object uploadGPS(String userAccount, String token, String fileName, String fileLength, HttpServletRequest request) {
Map<String, MultipartFile> multiRequest = ((MultipartHttpServletRequest)request).getFileMap();
MultipartFile multipartFile = multiRequest.get("file");
CommonsMultipartFile cf= (CommonsMultipartFile)multipartFile;
DiskFileItem fi = (DiskFileItem)cf.getFileItem();
File file = fi.getStoreLocation();
}