Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] web file download



On Tue, Feb 28, 2012 at 7:09 PM, Stephen Adler <adler at stephenadler.com> wrote:
> Hi Blu,
>
> I'm writing a web application which downloads files using PHP. The trick to
> getting a file to download using your browser is to send it a key set of
> header messages which tell the browser that a file is on its way. I've poked
> around the web to find several example of the headers that one needs to
> send, but as usual, there seems to be more under the surface than the simple
> 3 line example.

Is there a reason you can't just link them directly to the file and
let the web server itself handle it?  If there is, then to the best of
my recollection you really only need to set the content-type header,
possibly the content-length, then open the file and start reading and
sending the content.  It's been a little while since I did this last,
but from what I can recall it was much simpler than you seem to be
making it.

-Dan



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org