标签:http 文件 io art ar new file text
public
void importExcel(MultipartFile file, HttpServletRequest request) throws FileNotFoundException, IOException {
//tomcat下路径
String path = request.getSession().getServletContext().getRealPath("upload");
//上传文件名称
String fileName = file.getOriginalFilename();
System.out.println("****************开始***************");
File targetFile = new File(path, fileName);
if(!targetFile.exists()){
targetFile.mkdirs();
}
//保存
try {
file.transferTo(targetFile);
System.out.println("****************上传结束***************");
} catch (Exception e) {
e.printStackTrace();
}
标签:http 文件 io art ar new file text
原文地址:http://www.cnblogs.com/xiexy/p/3878478.html