|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-05-02 12:19 UTC] fred dot malone at planitcabnetware dot com
On my NT Srv 4 with IIS 4 and 2000 Srv with IIS 5 I have had the same problem. Running PHP 4.2, when I use readfile to download a binary file, the file size is two bytes greater than the original file size. The file is an executable file, and it has happened to more than one file. If you need any other information, let me know. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 22:00:01 2025 UTC |
Also, I checked the file size using the filesave function and it reports the correct file size. I have tried this using MSIE 6 and Netscape 6. I tried this from both WinXP and Win2000 workstations. My function looks like: function DownloadFile($filename) { // Check filename if (empty($filename)) { return FALSE; } // Create download file name to be displayed to user $saveasname = basename($filename); header('Content-Type: application/octet-stream'); header('Content-Length: '.filesize($filename)); $browser = $_SERVER["HTTP_USER_AGENT"]; if (preg_match('/MSIE 5.5/', $browser) || preg_match('/MSIE 6.0/', $browser)) { header('Content-Disposition: filename="'.$saveasname.'"'); } else { header('Content-Disposition: attachment; filename="'.$saveasname.'"'); } header('Content-Transfer-Encoding: binary'); // Output file readfile($filename); // Done return TRUE; }