For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > August 2004 > uploading and downloading in asp .net









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author uploading and downloading in asp .net
Matt Mercer

2004-08-30, 8:57 pm

Hi all,

I have a database application (asp .net vb) where I need to upload and
download files to a SQL database. I am not going to store the files in
the database...just the file name. All the files will be in the same
directory. I have searched around the web and found lots of
upload/download tutorials but nothing that is exactly what I need. The
webpage now will successfully upload files but I cannot download them
again. Maybe you all know of some links that would be helpful to be or
possibly some code I can plug into (one can always hope, right?) :)
Thank you!
Lan H. Nguyen

2004-08-30, 8:57 pm

You could use FileStream to read the file in byte array from where you saved
them then do Response.BinaryWrite( content ) it to browser. This will pop
the download dialog for user to download.

Remember to set response header, for instance:
Response.ContentType = "image/jpeg";
Response.AddHeader("Content-Disposition","attachment;filename=test.jpg");

Hope it helps.

"Matt Mercer" <mattmerc@bellsouth.net> wrote in message
news:37e3a036.0408301158.9aa0c32@posting.google.com...
> Hi all,
>
> I have a database application (asp .net vb) where I need to upload and
> download files to a SQL database. I am not going to store the files in
> the database...just the file name. All the files will be in the same
> directory. I have searched around the web and found lots of
> upload/download tutorials but nothing that is exactly what I need. The
> webpage now will successfully upload files but I cannot download them
> again. Maybe you all know of some links that would be helpful to be or
> possibly some code I can plug into (one can always hope, right?) :)
> Thank you!



Steve C. Orr [MVP, MCSD]

2004-08-30, 8:57 pm

You should be able to use Response.WriteFile to implement this
functionality.
Here's more info:
http://msdn.microsoft.com/library/d...br /> topic.asp

These articles might also help your efforts:
http://steve.orr.net/content/asp200307so_f.asp
http://aspalliance.com/das/tutorial/fileupload.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net



"Matt Mercer" <mattmerc@bellsouth.net> wrote in message
news:37e3a036.0408301158.9aa0c32@posting.google.com...
> Hi all,
>
> I have a database application (asp .net vb) where I need to upload and
> download files to a SQL database. I am not going to store the files in
> the database...just the file name. All the files will be in the same
> directory. I have searched around the web and found lots of
> upload/download tutorials but nothing that is exactly what I need. The
> webpage now will successfully upload files but I cannot download them
> again. Maybe you all know of some links that would be helpful to be or
> possibly some code I can plug into (one can always hope, right?) :)
> Thank you!



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com