about me

Download through PHP: unreliable Content-Length

Post replyCan't edit post
Watch topicCan't delete post
Friday, August 7 2009, 16:38
The CrimsonBase website verifies downloads by passing them through a robust PHP script similar to the one published by Andrew Johnson in his article about PHP-controlled file downloads.
Andrew makes a very important comment at the end of the article:
"If you compress files with Zlib, mod_deflate and so on the Content-Length header won't be accurate so you'll end up seeing "Unknown size" and "Unknown time remaining" when downloading files."
I would like to stress this: if your browser doesn't appear to be obeying the headers generated by your PHP script—especially Content-Length—it is fairly likely that Apache's mod_deflate extension is enabled.
You can easily disable it for a single script using the following line in an applicable .htaccess file:
SetEnvIfNoCase Request_URI ^/download\.php no-gzip dont-vary
where download.php is here assumed to be in the download script located in the server's root directory path (e.g. (That's because the regular expression is ^/download\.php.)
Actions:Post replyWatch topic
Stephin (guest)
Wednesday, July 4 2012, 12:46
Can't edit commentCan't delete comment
Working ;)
Post reply Hide comment

More updates

Click here to read more news items.
Members have extra privileges. You can login or register.
© 2005–2018 P. F. Lammertsma
No members currently online; 0 hits today by 0 unique users