62,041
社区成员
发帖
与我相关
我的任务
分享
string strFileName = str.Split(',')[0];
Response.ContentType = "application/x-zip-compressed";
//Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
string filename = Server.MapPath(strFileName);
string name = str.Split(',')[1];
Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlPathEncode(name));
//Server.UrlPathEncode()解决文件名的乱码问题.
Response.TransmitFile(filename);