ID: 16969
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Feedback
+Status: Open
Bug Type: IIS related
Operating System: Windows 2000 Server
PHP Version: 4.2.0
New Comment:
Actually, it does. Two blank lines to be precise. I just removed
those lines and tested and it works fine. Sorry about that. Shows I
am new to PHP, but I love it so far.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2002-05-02 12:53:51] [EMAIL PROTECTED]
Does the end of your script have a blank line after the ?>,
or do you have an auto_prepend file or some other include file that has
this??
------------------------------------------------------------------------
[2002-05-02 12:43:08] [EMAIL PROTECTED]
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;
}
------------------------------------------------------------------------
[2002-05-02 12:19:05] [EMAIL PROTECTED]
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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16969&edit=1