[thelist] Force file download from browser?

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

Hello Emilio,

E> [ Picked text/plain from multipart/alternative ]
E> Greetings!
E> Is there a way to force an “Href “ or “form” submission to open the
E> “Save as
” dialogue box?
E> For instance, <a href=www.company.com/downloads/file.mp3 >file to
E> download</a> will not open the file, rather the “Save as..” opens and
E> the user can save the file locally.

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

Anyhow, you'll have to print those two lines as the header.

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

More information about the thelist mailing list