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:27 am, Jochem Maas wrote:
>> 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");

Oh yeah.

Where did $size come from?

I see it nowhere...

>> $file = fopen($completePath, 'r');
>
> // no need to fopen/fclose if you decide to use readfile()...

readfile is great for small files.

Not so much for monster downloads, where the browser times out while
PHP tries to suck the whole file into RAM, in *some* versions of PHP.

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