Reputation: 2307
I have links in my web page that point to PDFs, that are in my server. I don't want want pdfs to be viewed in the browser bur directly downlodable when a user click on the link
Upvotes: 0
Views: 161
Reputation: 6653
just set the right header info. PHP file should look something like this.
<?
header('Content-disposition: attachment; filename=huge_document.pdf');
header('Content-type: application/pdf');
readfile('huge_document.pdf');
?>
as depicted here
http://webdesign.about.com/od/php/ht/force_download.htm
Regards
Upvotes: 1