欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp.net 文件下載實(shí)現(xiàn)代碼

 更新時(shí)間:2009年04月26日 01:08:16   作者:  
asp.net下實(shí)現(xiàn)文件下載的代碼。大家可以看下,主要包括文件名等操作。
復(fù)制代碼 代碼如下:

/// <summary>
/// 文件下載
/// </summary>
/// <param name="savename">文件名</param>
/// <param name="FullFileName">文件全名</param>
/// <param name="Response">Response</param>
public static void savefile(string savename,string FullFileName,System.Web.HttpResponse Response)
{
try
{
FileInfo DownloadFile = new FileInfo(FullFileName);
if (DownloadFile.Exists)
{
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename="+ System.Web.HttpUtility.UrlEncode(savename,System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();
}
else
{
//文件不存在
}
}
catch
{
//文件不存在
}
}

相關(guān)文章

最新評論