//从前台通过name值获取file MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request; MultipartFile multipartFile = multipartRequest.getFile("file"); //multipartFile转换成file CommonsMultipartFile cf= (CommonsMultipartFile)multipartFile; DiskFileItem fi = (DiskFileItem)cf.getFileItem(); File f = fi.getStoreLocation();