downloading a file
-
I am working on a small project in asp.net,I saved a file in a folder in the project and i saved the path of the file in the database,now i want to download the file saved in the folder through the path saved in database can please somebody send me the code for this thanking you Amar
-
I am working on a small project in asp.net,I saved a file in a folder in the project and i saved the path of the file in the database,now i want to download the file saved in the folder through the path saved in database can please somebody send me the code for this thanking you Amar
Hi Amar I have pasted the part of the code snippet which will allow you to show the windows download dialog button. This should be called on any of the server click event by passing the file name Hope this will solve your problem
mypath = myFileName file = New System.IO.FileInfo(mypath) If file.Exists Then frm.Response.Clear() frm.Response.AddHeader("Content-Disposition", "attachment; filename=" & file.Name) frm.Response.AddHeader("Content-Length", file.Length.ToString()) frm.Response.ContentType = strType frm.Response.WriteFile(file.FullName) frm.Response.End() Else frm.Response.Write("This file does not exist.") End If
Happy Programming Sasidar -- modified at 10:02 Wednesday 14th June, 2006