文件下载问题:文件名用空格截断! [英] File download problem: filename with spaces truncated!

查看:92
本文介绍了文件下载问题:文件名用空格截断!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆