中文可以改web.config的
<globalization
requestEncoding="GB2312"
responseEncoding="GB2312"
/>
那空格怎么办呢?
5 个解决方案
#1
trim()
#2
你把它另存为其他名字就是了!
#3
可是客户要求使用原名
这是他们的命名制度,不好改的
这是他们的命名制度,不好改的
#4
up
#5
在数据库存个原文件名,上传改名,用这样的函数下载
filename:实际文件名
oldName:上传的文件名
public void DownFile(string filename,string OldName)
{
System.IO.FileInfo file = new System.IO.FileInfo(filename);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + OldName);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
filename:实际文件名
oldName:上传的文件名
public void DownFile(string filename,string OldName)
{
System.IO.FileInfo file = new System.IO.FileInfo(filename);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + OldName);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
#1
trim()
#2
你把它另存为其他名字就是了!
#3
可是客户要求使用原名
这是他们的命名制度,不好改的
这是他们的命名制度,不好改的
#4
up
#5
在数据库存个原文件名,上传改名,用这样的函数下载
filename:实际文件名
oldName:上传的文件名
public void DownFile(string filename,string OldName)
{
System.IO.FileInfo file = new System.IO.FileInfo(filename);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + OldName);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
filename:实际文件名
oldName:上传的文件名
public void DownFile(string filename,string OldName)
{
System.IO.FileInfo file = new System.IO.FileInfo(filename);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + OldName);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}