FileInfo DownloadFile = new FileInfo(FullFileName); Response.Clear(); Response.ClearHeaders(); Response.Buffer = false; Response.ContentType = "application/octet-stream "; Response.AppendHeader( "Content-Disposition ", "attachment;filename= " + HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.UTF8)); Response.AppendHeader( "Content-Length ", DownloadFile.Length.ToString()); Response.WriteFile(DownloadFile.Name); Response.Flush(); Response.End(); 当我的文件名类似这样的深05025多层80.32.doc(80.32是建筑的面积,是客户要求的,必须这样)的时候,下载文件的时候保存的文件名是深05025多层80[1].32.doc 老是会多一个中括号。。我试验了下,只要有那个"."号,就会这样,没有".",就不会出现那个中括号了. 是什么问题,哪位大哥帮帮我啊
1 回答
慕无忌1623718
TA贡献1744条经验 获得超4个赞
doc文件应该是application/msword,你怎么是application/octet-stream
HttpUtility.UrlEncode(DownloadFile.FullName)就可以了,不加utf8试试
- 1 回答
- 0 关注
- 462 浏览
添加回答
举报
0/150
提交
取消