我正在构建文件的Ajax下载,但是返回的文件名已被删除:
原始文件名:
Toksykologia - wyklady 2010.doc.pdf
浏览器已下载:
Toksykologia
代码
HttpResponseBase response = HttpContext.Response;
FileInfo TheFile = new FileInfo(filePath);
response.Clear();
cookie.Value = "success";
response.SetCookie(cookie);
response.Buffer = true;
response.AddHeader("content-disposition", "attachment;filename=" + TheFile.Name);
response.Charset = "";
response.ContentType = "application/pdf";
response.WriteFile(TheFile.FullName);
response.Flush();
response.End();
答案 0 :(得分:1)
好的,我看到这是由空格char引起的,如果我将其更改为例如_
它运作正常