日期:2014-05-17 浏览次数:20430 次
/// <summary>
/// 下载指定路径文件
/// </summary>
/// <param name="path">文件绝对路径</param>
public static void DownLoadFile(string path, string oldFileName)
{
System.IO.FileInfo fi = new System.IO.FileInfo(path);
if (fi.Exists)
{
//判断文件是否正在使用
try
{
using (System.IO.FileStream fs = System.IO.File.Open(path, System.IO.FileMode.Append, System.IO.FileAccess.Write, System.IO.FileShare.None))
{
}
}
catch (Exception)
{
throw;
}
if (string.IsNullOrEmpty(oldFileName))
oldFileName = path.Substring(path.LastIndexOf("\\") + 1);
string browser = System.Web.HttpContext.Current.Request.UserAgent.ToUpper();
if (browser.Contains("FIREFOX") == true)
oldFileName = "\"" + oldFileName + "\"";
else if (browser.Contains("MSIE"))