refiking Posted January 2, 2010 Share Posted January 2, 2010 I am using these 3 lines to initiate a download which works in FF, but not IE. Any idea what is missing? <? header("Content-type:application/pdf"); header("Content-Disposition:attachment;filename=$file"); readfile($newfilelocation); ?> Link to comment https://forums.phpfreaks.com/topic/186963-problem-w-pdf-downloads-in-ie/ Share on other sites More sharing options...
MadTechie Posted January 2, 2010 Share Posted January 2, 2010 So what happens In IE (version unknown) and what was you expecting to happen ? do both have acrobat installed or another PDF handler ? Link to comment https://forums.phpfreaks.com/topic/186963-problem-w-pdf-downloads-in-ie/#findComment-987358 Share on other sites More sharing options...
refiking Posted January 3, 2010 Author Share Posted January 3, 2010 IE7 and IE8. I am expecting to download the pdf file whether I am in FF or IE. Link to comment https://forums.phpfreaks.com/topic/186963-problem-w-pdf-downloads-in-ie/#findComment-987372 Share on other sites More sharing options...
MadTechie Posted January 3, 2010 Share Posted January 3, 2010 So what does happen ? try this <?php header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: application/pdf" ); header("Content-Disposition: attachment; filename=\"".$file."\";"); header("Content-Transfer-Encoding: binary"); $filesize = filesize(newfilelocation); header("Content-Length: ".$filesize); readfile($newfilelocation); exit; ?> Link to comment https://forums.phpfreaks.com/topic/186963-problem-w-pdf-downloads-in-ie/#findComment-987374 Share on other sites More sharing options...
oni-kun Posted January 3, 2010 Share Posted January 3, 2010 IE handles headers a little more strictly, if not more conformed. Anything missing may deter the download from initiating. Link to comment https://forums.phpfreaks.com/topic/186963-problem-w-pdf-downloads-in-ie/#findComment-987377 Share on other sites More sharing options...
refiking Posted January 3, 2010 Author Share Posted January 3, 2010 In both IE and FF now, the downloaded file says the file is not a supported type or is damaged. Link to comment https://forums.phpfreaks.com/topic/186963-problem-w-pdf-downloads-in-ie/#findComment-987380 Share on other sites More sharing options...
MadTechie Posted January 3, 2010 Share Posted January 3, 2010 works for me [sCRIPT] http://madtechiesupport.com/freaks/downloadpdf.php [PDF] http://madtechiesupport.com/freaks/test.pdf <?php $file = "test.pdf"; $newfilelocation = "test.pdf"; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header ("Content-Type: application/pdf" ); header("Content-Disposition: attachment; filename=\"".$file."\";"); header("Content-Transfer-Encoding: binary"); $filesize = filesize($newfilelocation); header("Content-Length: ".$filesize); readfile($newfilelocation); exit; ?> Link to comment https://forums.phpfreaks.com/topic/186963-problem-w-pdf-downloads-in-ie/#findComment-987388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.