HttpServletRequest 转换成MultipartHttpServletRequest
//转换 HttpServletRequest
MultipartHttpServletRequest mulReq=(MultipartHttpServletRequest)request;
//获取上传的文件 CommonsMultipartFile file = (CommonsMultipartFile) mulReq.getFile("imageFile"); // 获取文件名称 String realFileName = file.getOriginalFilename(); System.out.println("文件名:" + realFileName);
//转换为 file DiskFileItem fi = (DiskFileItem)file.getFileItem(); File files = fi.getStoreLocation();