String root = getServletContext().getRealPath(“/”);
String path = root + “eWebEditor” + “/photo/” + filename;
int i = 0;
response.setContentType(“application/octet-stream”); //Response.ContentType 控制输出文件类型
response.setHeader(“Content-Disposition”,”attachment;filename = “+filename);
java.io.FileInputStream fileInputStream = new java.io.FileInputStream(path);
while((i= fileInputStream.read()) != -1){
System.out.println(i);
out.write(i);
}
}
用jspsmartupload下载txt文件
版权声明:本文为shunri原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。