How to download file from server database
-
Hi all, In order to download file i have written this code Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment; FileName=" + dt.Tables ["Attachment"].Rows[0]["Attachment_Name"].ToString()); Response.BinaryWrite((Byte[])dt.Tables["Attachment"].Rows[0]["Attachment_File"]); this code works well with SQL server but does nothing with MS Access. is there any alternative of this code is available or how can i make this code usefull for MS Access... Thanx to all
Regards, Qaiser Nadeem
-
Hi all, In order to download file i have written this code Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment; FileName=" + dt.Tables ["Attachment"].Rows[0]["Attachment_Name"].ToString()); Response.BinaryWrite((Byte[])dt.Tables["Attachment"].Rows[0]["Attachment_File"]); this code works well with SQL server but does nothing with MS Access. is there any alternative of this code is available or how can i make this code usefull for MS Access... Thanx to all
Regards, Qaiser Nadeem
Try with this code Private Sub Page_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Response.ContentType = "application\octet-stream" Dim filename as string=new string("c:\\downloads\\hi.doc") Dim downloadFile As System.IO.FileStream = New System.IO.FileStream(filename, IO.FileMode.Open) Response.Write(downloadFile.Length() & "#") downloadFile.Close() Response.WriteFile(filename) Response.Flush() Response.End() End Sub
Regards, Satips.:rose:
-
Try with this code Private Sub Page_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Response.ContentType = "application\octet-stream" Dim filename as string=new string("c:\\downloads\\hi.doc") Dim downloadFile As System.IO.FileStream = New System.IO.FileStream(filename, IO.FileMode.Open) Response.Write(downloadFile.Length() & "#") downloadFile.Close() Response.WriteFile(filename) Response.Flush() Response.End() End Sub
Regards, Satips.:rose:
its VB.NET, do u have c# code???
Regards, Qaiser Nadeem
-
its VB.NET, do u have c# code???
Regards, Qaiser Nadeem
hi check this http://www.developerfusion.co.uk/Utilities/[^] regards saravanan