[SOLVED] Serving PDF Files with PHP and IE6

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
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

[SOLVED] Serving PDF Files with PHP and IE6

Post by hawleyjr »

I'm having issues downloading PDF files served by PHP in IE6.

When the download box pops up and the user selects "Open" Adobe errors out. If the user saves the file and then opens the file. it is fine.

This is only happening in IE6 and on a non-secure server.

There is documentation about this bug but for ssl http://support.microsoft.com/kb/812935

Also, I have tried sending a variety of headers.

Code: Select all

 
        header("Content-type: " . $file_info['file_type'] );
        header("Content-Length: " . $file_info['file_size'] );
        header("Cache-Control: public, must-revalidate");
        header("Pragma: 0");
        
        header("Content-Disposition: attachment; filename=" . $file_info['file_name'] );   
 
Edit: Other resources I've found but aren't helping.

http://drupal.org/node/93787
http://elgg.org/trac/attachment/ticket/ ... nload.diff
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Re: Serving PDF Files with PHP and IE6

Post by hawleyjr »

Well, I was able to get it to work in IE 6 using the following headers:

Code: Select all

 
header("Content-type: " . $file_info['file_type'] );
header("Content-Length: " . $file_info['file_size'] );
header("Pragma: private");
header("Cache-Control: private");       
header("Content-Disposition: attachment; filename=" . $file_info['file_name'] );    
readfile( $actual_file_path ); 
 
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Re: [SOLVED] Serving PDF Files with PHP and IE6

Post by Luke »

I had this same problem way back in '05... viewtopic.php?f=14&t=38997

funny... at the end of that thread I say "This is a good forum... I think I'll hang out here more often" haha
Post Reply