开发者

Download pdfs and not show in the browser

I have links in my web page that point to PDFs, that开发者_JS百科 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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜