php-windows | 2002071
Date: 07/02/02
- Next message: Alex Elderson: "[PHP-WIN] Re: Problem with file download/fopen/fread"
- Previous message: Peter: "RE: [PHP-WIN] Followed install.txt... and NOTHING"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I have made a php script ware you can download some files, but it doesn't
work very well
After the first "echo fread($fc, 10240);" line it will send some strange
data
what to do?
if (!($fc = fopen($path . $file, "rb"))) {
echo "error\n";
exit;
}
$file_size = filesize($path . $file);
ob_end_clean();
ignore_user_abort(false);
if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')){
// IE cannot download from sessions without a cache
header('Cache-Control: public');
}
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$file."\"");
header("Content-length: ".(string)($file_size));
if ($description!="") {
header("Content-Description: " . $description);
}
while(!feof($fc)) {
set_time_limit(5);
echo fread($fc, 10240);
flush();
}
fclose($fc);
exit;
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Alex Elderson: "[PHP-WIN] Re: Problem with file download/fopen/fread"
- Previous message: Peter: "RE: [PHP-WIN] Followed install.txt... and NOTHING"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

