Jump to content

File Download Problem


imangh

Recommended Posts

hello

I have a problem with a page that let users to download file. It work correctly from IE but not in FF!

file in FF is 25 byte lest than file downloaded by IE in length.

 

if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT']))

{

ob_end_clean();

}

if(!file_exists(FilesDirectory.$FileName))

{

echo "Invalide request!";

exit();

}

header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');

header("Content-type: application/zip");

header("Content-Disposition: attachment; filename=\"".md5($FileName).".zip\"");

 

if ('IE') {

header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

header('Pragma: public');

} else {

header('Pragma: no-cache');

}

 

header('Cache-Control: max-age=604800');

 

header("Content-Length: ".@filesize(FilesDirectory.$FileName));

 

readfile(RootDirectory."files/".$FileName);

 

in configuration file I used ob_start("ob_gzhandler") I try to solve problem by placing ob_end_clean(), some time IE have error and some time FF.

I don't know what to do exactly!

Link to comment
https://forums.phpfreaks.com/topic/84371-file-download-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.