Page 1 of 1

sending a file to the browser for download automatically

Posted: Sat Dec 14, 2002 9:38 pm
by maltune
I'm wanting to write a script that will allow users to download a file without being able to see where the file's stored or be able to download it if he/she isn't logged in and a session created. I've seen lots of sites that have this for downloading files (sourceforge.net, tucows.com ect).

For example: sites will sometimes have something saying "download will start shortly, click here if nothing happens" and then the file is sent automatically after the page is loaded.

Has anyone done this before? I'm thinking maybe I have to send the appropriate headers and stream the output of the file I want to send??

Anyone have a suggestion?

thanks,
jeremy

Posted: Sat Dec 21, 2002 4:53 pm
by evilcoder
Yeah, i do this on my site.

http://www.clandazed.com/?com=DigitalPictures

Check that out see if that's what your after.

But as with any script like that, it took me under 5 minutes to make and is about as secure as simple download scripts go, but no matter what you use, people will always be able to find out where the file is coming from, you can't fool HTTP redirects.