Zip File Downloads are empty when using Internet Explorer

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
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Zip File Downloads are empty when using Internet Explorer

Post by jwalsh »

I have the following download script in place for downloading a file that was previously uploaded. This works great on all browsers which are not of the IE variety.

Code: Select all

 
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$tempFile->Filename);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($tempFile->Filename));
 
ob_end_clean();
flush();
        
readfile($tempFile->URL);
        
exit;
 
The file downloads without error, but it's simply empty.
Post Reply