public void Download() { string filename = "Socha Na Tha "; if (filename != "") { string path = Server.MapPath(filename); System.IO.FileInfo file = new System.IO.FileInfo("D://Socha Na Tha.avi"); if (file.Exists) { Response.Clear(); Response.AddHeader("Content-disposition", "attachment; filename=" + filename); Response.AddHeader("content-Length", file.Length.ToString()); Response.ContentType = "application/octet-stream";// Response.WriteFile(file.FullName); Response.End(); } else { Response.Write("this file does not exist"); } } } protected void Button1_Click(object sender, EventArgs e) { Download();
}
|
No comments:
Post a Comment