saving files from database
-
Hi there. I have saved an MS word file to my database. I retrieve the following fields when accessing the DB: byte[], filename, extension I now want to, in code behind, open an "Download to" window, where i can save the file on my local machine. P.S i dont just save word files... i want to save any type of file. Can anyone help me with the problem?
-
Hi there. I have saved an MS word file to my database. I retrieve the following fields when accessing the DB: byte[], filename, extension I now want to, in code behind, open an "Download to" window, where i can save the file on my local machine. P.S i dont just save word files... i want to save any type of file. Can anyone help me with the problem?
Did you look at
Response.WriteFile
?Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
Did you look at
Response.WriteFile
?Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
Basically, you set the header to say you're downloading the file, and then stuff the bytes of the file into there. You should ask ASP.NET questions in the ASP.NET forum BTW.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Basically, you set the header to say you're downloading the file, and then stuff the bytes of the file into there. You should ask ASP.NET questions in the ASP.NET forum BTW.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
it is a bit unclear, what header are you talking about? "you set the header to say you're downloading the file". could you give me an example of this? Sorry about the "Not being in an asp forum"..
Icarus123 wrote:
it is a bit unclear, what header are you talking about?
He would be talking about HTTP headers.
Icarus123 wrote:
could you give me an example of this?
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
it is a bit unclear, what header are you talking about? "you set the header to say you're downloading the file". could you give me an example of this? Sorry about the "Not being in an asp forum"..
Response.ContentType="application/zip"; Response.AddHeader( "content-disposition","attachment; filename="+filename); Response.BinaryWrite(byteArray); Response.End(); That will cause whatever you want, to be written to the browser so the user downloads it.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Icarus123 wrote:
it is a bit unclear, what header are you talking about?
He would be talking about HTTP headers.
Icarus123 wrote:
could you give me an example of this?
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions