日期:2014-05-18 浏览次数:20486 次
System.IO.FileInfo file = new System.IO.FileInfo(fileName); if (file.Exists) { System.IO.FileStream fs = null; fs = System.IO.File.Open(fileName, System.IO.FileMode.Open); byte[] btFile = new byte[fs.Length]; fs.Read(btFile, 0, Convert.ToInt32(fs.Length)); fs.Close(); System.Web.HttpContext.Current.Response.Clear(); System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name); System.Web.HttpContext.Current.Response.AddHeader("Content-Length", file.Length.ToString()); System.Web.HttpContext.Current.Response.ContentType = "audio/mpeg3"; System.Web.HttpContext.Current.Response.BinaryWrite(btFile); }