php-windows | 2002071
Date: 07/02/02
- Next message: Alex Elderson: "[PHP-WIN] Re: Problem with file download/fopen/fread"
- Previous message: Alex Elderson: "[PHP-WIN] Downloading files?"
- Next in thread: Alex Elderson: "[PHP-WIN] Re: Problem with file download/fopen/fread"
- Reply: Alex Elderson: "[PHP-WIN] Re: Problem with file download/fopen/fread"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I have the same problem
Mail me if you have an idee (alex <email protected>)
if (!($fc = fopen($base_path . $path . $file, "rb"))) {
echo "error\n";
exit;
}
$file_size = filesize($base_path . $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;
In article <20020619202210.96898.qmail <email protected>>, dariusz <email protected> says...
>
>
>OS: WinXP Pro
>Apache 2.0.36
>PHP 4.2.1 (module)
>
>
>A simple script:
>
>$f = "e:/web/old.zip";
>header("Content-type: application/zip");
>header("Content-Disposition: attachment; filename=old.zip");
>header("Content-Length: " . filesize($f));
>$fp = fopen($f, "rb");
>if (!$fp) exit("FILE ERROR");
>while (!feof($fp))
>{
> print fread($fp, 4096);
>}
>fclose($fp);
>
>
>The first ~8kB of the downloaded file are OK but from then on the downloaded
>file is totally screwed up, the filesize is correct though.
>With small files it seems to work fine (the one above is ~11MB).
>
>Also tried with readfile(..) and with fpassthru(..), doesn't work either.
>
>Anyone encountered similar problems or even better: has a solution to this?
>
>-- Dariusz
>
>
>
-- 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: Alex Elderson: "[PHP-WIN] Downloading files?"
- Next in thread: Alex Elderson: "[PHP-WIN] Re: Problem with file download/fopen/fread"
- Reply: Alex Elderson: "[PHP-WIN] Re: Problem with file download/fopen/fread"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

