[Discuss] web file download
Daniel C.
dcrookston at gmail.com
Tue Feb 28 23:22:35 EST 2012
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
More information about the Discuss
mailing list