[thelist] Force file download from browser?

Michiel Trimpe M.B.Trimpe at student.tue.nl
Wed May 15 06:25:01 CDT 2002


Hello David,

>> 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");

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

Ok you got me there, but you will still want to specify some MIME
type. Only use the octet-stream if you can't avoid it. If you're only
sending MP3 files then try Content-type: audio/x-mpeg  .
That should do the trick.

--
Best regards,
 Michiel                            mailto:M.B.Trimpe at student.tue.nl





More information about the thelist mailing list