Mind_nl
Mon 8 October 2007, 11:21 am GMT +0200
After getting annoyed a few too many times after opening .pdf file in the browser window I looked into forcing the download so the 'save as' window pops up after clicking on a .pdf link (like it does when clicking on a link to a .zip file)
I found a way to force the download and added a counter as well. You can see the complete script on my php tutorial site here:
force .pdf downloadHope you like it!
olaf
Mon 8 October 2007, 12:33 pm GMT +0200
add this header too:
header ("Cache-control: private");
Nikolas
Mon 8 October 2007, 12:37 pm GMT +0200
The best is to use this :
header("Cache-Control: public");
header("Pragma: public");
header("Content-Description: File Transfer");
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=$fnam");
header("Content-Transfer-Encoding: binary");
?>
The Content-type: application/octet-stream will make the file downloaded no matter the file type or extension.
olaf
Mon 8 October 2007, 12:42 pm GMT +0200
and at last this header:
header("Best-webmaster-forum: Webdigity");
:D
Nikolas
Mon 8 October 2007, 12:45 pm GMT +0200
LOL :)
Mind_nl
Mon 8 October 2007, 01:08 pm GMT +0200
That last header isn't working Olaf. I've send an e-mail to php.net to ask how to use that header, since it isn't in the php manual. They must have missed it somehow...
olaf
Mon 8 October 2007, 01:16 pm GMT +0200
That last header isn't working Olaf. I've send an e-mail to php.net to ask how to use that header, since it isn't in the php manual. They must have missed it somehow...
Nico, don't send this to php.net, headers are coordinated by the W3C
:)
Mind_nl
Mon 8 October 2007, 01:17 pm GMT +0200
I already send it, I'll just send a copy of the mail to W3C then ;D
Nikolas
Mon 8 October 2007, 01:18 pm GMT +0200
Hehe, we will be the first site with each owns headers :)
olaf
Mon 8 October 2007, 01:20 pm GMT +0200
Hehe, we will be the first site with each owns headers :)
right a new standard:
header("Personal-Header: Olaf Lederer");