[thelist] Force file download from browser?

Mark Gallagher mark at cyberfuddle.com
Wed May 15 06:29:01 CDT 2002


David Dorward wrote:
> 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
> http://www.htmlhelp.com/faq/html/media.html#force-download

A quick look at http://allmyfaqs.com/faq.pl?Launch_executable might also
be in order.  Okay, so it deals with the opposite question ("how do I
*prevent* the 'Save As' dialogue box?"), but it's the same point.

Sometimes, whether the OP is willing to believe it or not, we (the
users) *like* to be able to control, for *ourselves*, how our browsers
behave.  Forcing "Save As", preventing "Save As", whatever.  It's our
choice whether we save something permanently to disk or simply view it
in our browsers and, frankly, none of the web designer's damn business.


--
Mark Gallagher
http://cyberfuddle.com/infinitebabble/





More information about the thelist mailing list