文件下载问题:文件名用空格截断! [英] File download problem: filename with spaces truncated!
问题描述
虽然我在code工作使用从服务器下载文件:
While I am working on code to download file from server using :
Response.AddHeader("Content-Disposition", "attachment; filename=" +
Server.UrlPathEncode(Path.GetFileName(_Filename)));
问题是,同时具有文件名空间,与此code服务器自动分割,而在发现第一个空间!
The problem is while having spaces in the file name, with this code the server split automatically while finding the first space!
我希望知道为什么和放大器;什么是该解决方案?
I'm hoping to know Why & what is the solution for that?
推荐答案
我找到了解决方案:)
I found the solution :)
我们必须围绕文件名用双cotation这样的:
We have to surround the filename with double cotation like :
Response.AddHeader(内容处置,附件;文件名= \\+ Path.GetFileName(_filename)+\\);
Response.AddHeader("Content-Disposition", "attachment; filename=\"" + Path.GetFileName(_Filename) + "\"");
不过,到目前为止,我没有对这种分裂任何想法?
But up till now, I didn't have any idea for this split?
这篇关于文件下载问题:文件名用空格截断!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!