hi all. this is freaking me out! i have a link on my page that calls the below script. the below script determines whether a session id is set with $num=1 (that's all i need), and if so, the below sript is supposed to feed the file.zip for download in a browser via a download-the-file box generated by the browser. the file.zip lives outside of my rootweb so nobody can try and steal, assuming a good hosted server. now, in IE, this works great, but in NN i get a supposedly corrupt file.zip download when i try to unzip it. why? how can i fix? see the bald spots??? please help pretty please???
<?
$num = "0";
session_id($uid); <-- coz i'm passing as a var so OK to be here with $
session_cache_limiter('public'); <-- an attempt to get it to work
session_start();
if ($num != "1") {
echo "You cannot access this page. If you feel this is in error, please e-mail info AT domain DOT com.";
session_destroy();
die();
}
else {
$fileDir = '/path/to/dir';
$fileName = 'file.zip';
$completeFilePath=$fileDir.'/'.$fileName;
//header('Cache-Control: no-cache, private, must-revalidate');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); <-- trying something
//header('Pragma: no-cache');
header('Pragma: public'); <-- again trying
header("Content-type: application/octet-stream"); <-- no way no how i can get application/zip to work with IE or NN!
header("Content-Disposition: infile; filename=\"$fileName\"");
header("Content-length: ".(string)(filesize($completeFilePath)));
//header("Content-type: application/octet-stream\nContent-Disposition: infile; filename=\"".$fileName."\"\nContent-length: ".(string)(filesize($completeFilePath)));
$fd=fopen($completeFilePath,'rb');
fpassthru($fd);
session_destroy();
}
?>
i've even tried using "file" as in usr/bin/file to determine the mime type, but this bombs in IE and NN also. i've also tried application/whatever-you-can-think-of and IE bombs if not application/octet-stream.
any help would be so greatly appreciated
<?
$num = "0";
session_id($uid); <-- coz i'm passing as a var so OK to be here with $
session_cache_limiter('public'); <-- an attempt to get it to work
session_start();
if ($num != "1") {
echo "You cannot access this page. If you feel this is in error, please e-mail info AT domain DOT com.";
session_destroy();
die();
}
else {
$fileDir = '/path/to/dir';
$fileName = 'file.zip';
$completeFilePath=$fileDir.'/'.$fileName;
//header('Cache-Control: no-cache, private, must-revalidate');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); <-- trying something
//header('Pragma: no-cache');
header('Pragma: public'); <-- again trying
header("Content-type: application/octet-stream"); <-- no way no how i can get application/zip to work with IE or NN!
header("Content-Disposition: infile; filename=\"$fileName\"");
header("Content-length: ".(string)(filesize($completeFilePath)));
//header("Content-type: application/octet-stream\nContent-Disposition: infile; filename=\"".$fileName."\"\nContent-length: ".(string)(filesize($completeFilePath)));
$fd=fopen($completeFilePath,'rb');
fpassthru($fd);
session_destroy();
}
?>
i've even tried using "file" as in usr/bin/file to determine the mime type, but this bombs in IE and NN also. i've also tried application/whatever-you-can-think-of and IE bombs if not application/octet-stream.
any help would be so greatly appreciated