View Full Version : Turning off Content-length
Ultragames
01-19-2006, 05:55 PM
On one server, PHP 5, this line returns the proper file size to the browser.
$filesize = filesize($filename);
header("Content-length: ".$filesize);
However on a remote server, running PHP 4.3.8, the Content-length header will not return a value. I checked the $filesize variable, and it does contain the right size, its just not being set in the header.
What value in the PHP setup can disable this? I need to get this fixed. With PDFs, having no content-length can cause IE to not start the Adobe Plugin, and its annoying as well.
Thanks guys.
marek_mar
01-19-2006, 07:35 PM
It should work. You should check if the header is really sent.
Ultragames
01-19-2006, 07:40 PM
Server logs say headers were sent, but get_headers() and the IE and FF browsers agree that its not...
marek_mar
01-19-2006, 07:47 PM
I thought you said you have problems with PHP4 not PHP5.
Ultragames
01-19-2006, 09:03 PM
I do.
marek_mar
01-19-2006, 10:46 PM
Well get_browser() is PHP5 only... so |I don't know how it can say anything on PHP4.
Ultragames
01-19-2006, 10:51 PM
Im not using get_browser, im using get_header() (http://www.php.net/manual/en/function.get-headers.php).
The point is that the content-length header is not being sent on 4.3.8
What server setting can cause this? The code is right.
marek_mar
01-19-2006, 11:12 PM
Damn I'm dumb... get_headers() is PHP5 only...
Ultragames
01-19-2006, 11:51 PM
Again... Thats not the point. I've said this.
I used get_headers() on a PHP5 server to make sure that the code generated the headers. It does. Thats the only point of me menitoning it. Its not an integral part of the script.
Any ideas as far as my acual question go? What is causing 4.3.8 to not send the content-length when using application/force-download on PHP 4.3.8?
marek_mar
01-20-2006, 12:36 AM
It simply should work IMO.
I've checked a PHP4 php.ini and I didn't find any setting that would enable you to block certian headers.
It might be the server itself.
Ultragames
01-20-2006, 02:10 AM
Thanks for the research. I appreciate it.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.