php Code to start download of pdf

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shivchal
Forum Newbie
Posts: 1
Joined: Tue Aug 17, 2010 9:59 pm

php Code to start download of pdf

Post by shivchal »

Hi all,
I have a website with a link to pdf, present in the site. When I click that link, the pdf opens in the browser. Is there a way to download the PDF?
When I click on the link to pdf, I don't want the browser to open in a new tab, but instead prompt for typical file download option. "Save As or open with".

Thanks a lot for all your voluntary help.

regards,
shiva
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: php Code to start download of pdf

Post by requinix »

With PHP you'd use header. At a server level you can force a "application/octet-stream" content type on whichever files should be downloaded.
Post Reply