phpretard Posted April 17, 2009 Share Posted April 17, 2009 I have files that normally you would right click or control click to download (pdf, doc, ect...). Is there any way to just left click and open a "save or open window" like a what happens with a .zip file? Link to comment https://forums.phpfreaks.com/topic/154494-solved-auto-download-a-pdf/ Share on other sites More sharing options...
premiso Posted April 17, 2009 Share Posted April 17, 2009 Maybe with javascript. But not with PHP. Especially a PDF since the plugin effects the browser to auto-open that type. Link to comment https://forums.phpfreaks.com/topic/154494-solved-auto-download-a-pdf/#findComment-812315 Share on other sites More sharing options...
mtoynbee Posted April 17, 2009 Share Posted April 17, 2009 Use headers: <?php // We'll be outputting a PDF header('Content-type: application/pdf'); // It will be called downloaded.pdf header('Content-Disposition: attachment; filename="downloaded.pdf"'); // The PDF source is in original.pdf readfile('original.pdf'); ?> Link to comment https://forums.phpfreaks.com/topic/154494-solved-auto-download-a-pdf/#findComment-812317 Share on other sites More sharing options...
phpretard Posted April 17, 2009 Author Share Posted April 17, 2009 Thanks for the help! Link to comment https://forums.phpfreaks.com/topic/154494-solved-auto-download-a-pdf/#findComment-812324 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.