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); ?> Quote Link to comment 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 ? Quote Link to comment 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. Quote Link to comment 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; ?> Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.