Download adds ^M to beginning of file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Using the below code to force download works fine on most servers and with most
browsers. However it does "crash" Firefox when I download a specific file, IE
works like beauty. File content starts with:

#!/sbin/_joor_perl_use Filter::decrypt......

This is the code to force the download:

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$file\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: $size");
$file = fopen($completePath, 'r');

while(ob_get_level()) {
	ob_end_flush();
}

while(!feof($file)) {
	echo fread($file, 2048);
}

fclose($file);

Where can I start? Could it be server config? Or could it have to do with flush?
If I remove the ob_end_flush() it does not crash Firefox.

Best regards,
Peter Lauri

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux