首页 > 其他 > 详细

文件下载相关

时间:2014-03-27 10:12:56      阅读:457      评论:0      收藏:0      [点我收藏+]

通过push下载文件

doc文件

FileInfo fileInfo = new FileInfo(filePath);
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" + retuFileName);
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
Response.WriteFile(fileInfo.FullName);
Response.Flush();
Response.End();

zip文件

Response.Clear();
Response.ClearContent();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + fileZip);

Response.TransmitFile(dirZipPath);
Response.Flush();
Response.Close();

文件下载相关,布布扣,bubuko.com

文件下载相关

原文:http://www.cnblogs.com/zhangji/p/3624827.html

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