download file from the folder
i want to download a fille from folder while download button is click .i need code in asp.net c# language
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Joginder BangerPosted Feb 23, 2014, 9:48 AM
protected void Button1_Click(object sender, EventArgs e){const string fName = @"C:\picture.bmp";FileInfo fi = new FileInfo(fName);long sz = fi.Length;Response.ClearContent();Response.ContentType = MimeType(Path.GetExtension(fName));Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}",System.IO.Path.GetFileName(fName)));Response.AddHeader("Content-Length", sz.ToString("F0"));Response.TransmitFile(fName);Response.End();}