首页 > 其他 > 详细

直接通过Response输出流写文件,浏览器表现为下载文件

时间:2015-07-17 18:12:29      阅读:1252      评论:0      收藏:0      [点我收藏+]

response.setContentType("application/x-download");
response.addHeader("Content-Disposition", "attachment;filename="+new String( "中文".getBytes("utf-8"), "ISO8859-1" )+"文件类型");

OutputStream out = response.getOutputStream();

向out中写入流

out.flush();

response.flushBuffer();

即可

直接通过Response输出流写文件,浏览器表现为下载文件

原文:http://www.cnblogs.com/guangshan/p/4654972.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!