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();

 

posted @ 2016-05-26 10:54  ice.ko  阅读(5231)  评论(0编辑  收藏  举报