Re: Download adds ^M to beginning of file

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

 



On Tue, December 12, 2006 9:12 am, lists@xxxxxxxxxxx wrote:

Based on your subject line, I'd suggest looking for an included PHP
script that has a stray newline (a Windows newline, actually) before
the <?php or after the ?>

> 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......

If you are using Perl, why are you posting it here?...

> 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");

I know I've posted this twice today, but here we are again:
http://richardlynch.blogspot.com/

> $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.

Why do you have the ob_end_flush() in there anyway?

Is this code on your server that you control?

Then you shouldn't have any ob_start() calls in your way in the first
place. :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
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