日期:2014-05-19  浏览次数:20422 次

文件下载时,默认文件名称在哪改?
文件下载时,默认文件名称在哪改?
我用的是C#的最简单的代码,求高手指点一二。

private   void   FileDownLoad(string   FullFileName)
{
System.IO.FileInfo   DownloadFile=new   System.IO.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.FullName);
Response.Flush();
Response.End();
}

------解决方案--------------------
Response.AppendHeader( "Content-Disposition ", "attachment;filename= "+HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.UTF8));


DownloadFile.FullName ------------》 这里吧
------解决方案--------------------
Response.AppendHeader( "Content-Disposition ", "attachment;filename= "+HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.UTF8));


DownloadFile.FullName ------------》 这里吧