[thelist] Force file download from browser?

David Dorward david at david.us-lot.org
Wed May 15 04:49:01 CDT 2002

On Wed, May 15, 2002 at 08:55:11AM +0200, Michiel Trimpe wrote:
> Hello Emilio,
> E> Greetings!
> E> Is there a way to force an ?Href ? or ?form? submission to open the
> E> ?Save as?? dialogue box?

> Yes, it involves headers you'll have to send out with the request.

> In PHP that would look like
> header("Content-type: application/pdf");
> header("Content-Disposition: attachment; filename=downloaded.pdf");

Sending a header that states the file is a pdf probably isn't a wise
choice, many people have the Acrobat Reader plugin and this is likely
to try to trigger that plugin to display the file. The result it lots
of errors about curoupt or otherwise damanged files.

I suggest reading through

David Dorward                                   http://david.us-lot.org/
HTML email is a bit like using coloured paper and glitter ink on a CV.

More information about the thelist mailing list