Bug #15613 Updated: readfile doesn't work correctly with WIndows XP
| From: | khoukaz at web dot de | Date: | Tue, 19 Feb 2002 10:09:05 +0000 |
| Subject: | Bug #15613 Updated: readfile doesn't work correctly with WIndows XP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-553@lists.php.net to get a copy of this message | ||
ID: 15613
Updated by: khoukaz@web.de
Reported By: khoukaz@web.de
Status: Feedback
Bug Type: Output Control
Operating System: Windows XP (Professional)
PHP Version: 4.1.1
New Comment:
No, it's not a problem of the image presentation. The files (the
original and the downloaded one) differ. The same probleme occurs with
text files. Below you will find a comparision between an original text
file and what the download makes of it:
------- a cutting of apache httpd.conf ----------------
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule php4_module modules/php4apache.dll
#
# Reconstruction of the complete module list from all available
modules
# (static and shared ones) to achieve correct module execution order.
#
# The modules listed below, without a corresponding LoadModule
directive,
# are static bound into the standard Apache binary distribution for
Windows.
#
# Note: The order in which modules are loaded is important. Don't
change
# the order below without expert advice.
#
# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE, UPDATE THIS TOO!]
ClearModuleList
#AddModule mod_vhost_alias.c
AddModule mod_env.c
AddModule mod_log_config.c
#AddModule mod_mime_magic.c
...
-------------------------------------------------------
--------------- the downloaded part -------------------
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule php4_module modules/php4apache.dll
#
# Reconstruction of the complete module list from all available
modules
# (static and shared ones) to achieve correct module execution order.
#
# The modules listed below, without a corresponding LoadModule
directiveRCRD(. .í
ë.....pì..h......Ôë....Y±........Á...........ë....äë....äë....Ð.........h..............(.¨Ð...........÷......Ë.....FILE0..Àë......8..¨................Þ_............`...........H......,åÙ¼¹Á,åÙ¼¹Á,åÙ¼¹Á,åÙ¼¹Á
...................\..................0...x..........Z.....[.....,åÙ¼¹Á,åÙ¼¹Á,åÙ¼¹Á,åÙ¼¹Á................
.......R.E.S.U.L.T.~.3...H.T.M.t.m...0...x..........^.....[.....,åÙ¼¹Á,åÙ¼¹Á,åÙ¼¹Á,åÙ¼¹Á................
.....Y±r.e.s.u.l.t.s.[.2.]...h.t.m......................ÿÿÿÿyGHë....ë............(..........h.............(...(.....................Zá..Së....................@..........h.............(...(.........÷......Ë........................aë....Së....Së....p..........h.............(.H.p..........÷......Ë........H.................ÿÿÿÿÿÿÿÿ@...................................£3<øuë....aë....aë....0..........h.............(..(..¬.................Ræ...Y±~.....ë....uë....uë....X..........h.............(..@.........÷......Ë....................................................ë....ë....ë....8..........h........... . .(..0....@....÷......Ë.....!~.ð....£3<øë....ë............(..........h.............(...(..................... Ûü.yïªë....................0..........h.............(..(..¬................Tæ.....@.....¶ë....ªë....ªë....H..........h........... . .(..8....E....ó....Y±Ë......ßáÄwï......=øèAÙ.....Åë....¶ë....¶ë....X..........h.............(..@.........ó......Ë......
......_......_.......@......_......_......Öë....Åë....Åë..............h.............(.8..8.Ä...à...........˽.....ʦv»¹Á~k{»¹Á~k{»¹Á~k{»¹Á.
......_...... .......ʦv»¹Á~k{»¹Á~k{»¹Á~k{»¹Á.@......_......
.......ïë....Öë....Ö`ë..............h......
.......(.8.`.8.Ä...P...........˽.....ʦv»¹Á~k{»¹Á~k{»¹Á~k{»¹Á.
......_....Y± .......ʦv»¹Á~k{»¹Á~k{»¹Á~k{»¹Á.@......_......
.......ë....ïë............(..........h.............(...(.....................Àxï<U`ë..............................h.............(.0.X.0...8.0....ö......Ë.....:á¼¹Á
...................\..................Õ¸Á
...................\..................*ë....ë....ë..............h.............(.8..8.Ä... ...........˽.....Õ¸ÁÕ¸ÁÕ¸Á:á¼¹Á.
............. .......Õ¸ÁÕ¸ÁÕ¸ÁÕ¸Y±. .............
.......Cë....*ë....*ë..............h.............(.8..8.Ä... ...........˽.....Õ¸ÁÕ¸ÁÕ¸Á:á¼¹Á.
............. .......Õ¸ÁÕ¸ÁÕ¸ÁÕ¸Á. .............
.......\ë....Cë............(..........h.............(...(.....................Àøï<Ugë..............................h.............(.0.X.0...8.0................:á¼¹Á....................t..................ð±b¸Á....................t..................~ë....gë..Y±gë..............h.............(.8..8...............É.....(ðÁ¸Á¢$^b¸Á¢$^b¸Á:á¼¹Á.......................(ðÁ¸Á¢$^b¸Á¢$^b¸Áð±b¸Á.......................ë....~ë............(..........h.............(...(.....................èÚü°øï¢ë....................0..........h.............(..(..È..............................®ë....¢ë....¢ë....(..........h..............(...(............$......¼Ë.....¹ë....®ë....®ë....¨..........h.............(.Y±¨...@...............p°...........n.....[.....:á¼¹Á:á¼¹Á:á¼¹Á:á¼¹Á................
.......A.r.c.h.i.v.e.0.0.0.0.0.0.0.1.[.1.]...j.p.g...Ôë....¹ë....¹ë..............h.............(.p....@...8............p°..........p.Z.....[.....:á¼¹Á:á¼¹Á:á¼¹Á:á¼¹Á................
.......A.R.C.H.I.V.~.1...J.P.G.g.i.f.íë....Ôë....Ô`ë....à.........h.............
(.¸à...........$......¼Ë.....FILE0..®ë......8..¸.............................Y±RCRD(. .ë!ë.....pì..X......à!`ë....Z±....Á......c.Á..............H......:á¼¹Á:á¼¹Á:á¼¹Á:á¼¹Á
...................\..................0...x..........Z.....[.....:á¼¹Á:á¼¹Á:á¼¹Á:á¼¹Á................
.......A.R.C.H.I.V.~.1...J.P.G.0.0.1.0.............n.....[.....:á¼¹Á:á¼¹Á:á¼¹Á:á¼¹Á................
.......A.r.c.h.i.v.e.0.0.0.0.0.0.0.1.[.1.]...j.p.g......................ÿÿÿÿyG7
ë....íë............(..........h.............(...(...........Z±........bÏQá,.,.B
`ë....................@..........h.............(...(.........$......¼Ë........................P
ë....B ë....B
`ë....p..........h.............(.H.p..........$......¼Ë........H.................ÿÿÿÿÿÿÿÿ@...................................£3<ød
ë....P ë....P
`ë....0..........h.............(..(..¬................næ.....n.....p
ë....d ë....d
`ë....X..........h.............(..@.........$......¼Ë......
....................................Z±........ ë....p ë....p
`ë....8..........h........... . .(..0....@....$......¼Ë.....1n.ð....£3<ø
`ë....
`ë............(..........h.............(...(..................... Ûü.É
õ
`ë....................X..........h.............(..@.........$......¼Ë......
..............³....... ......................ª ë.... ë....
ë..............h.............(.8..8.@...............p°.....:á¼¹Á:á¼¹Á:á¼¹Á:á¼¹Á.
......³...... .......:á¼¹Á:á¼¹Á:á¼¹Á:á¼¹Z±................
.......Ã ë....ª ë....ª
ë..............h.............(.8..8.@...8............p°.....:á¼¹Á:á¼¹Á:á¼¹Á:á¼¹Á.
......³...... .......:á¼¹Á:á¼¹Á:á¼¹Á:á¼¹Á................
.......Ü `ë....Ã
`ë............(..........h.............(...(.....................ÀÈ
õ<Uç
`ë..............................h.............(.0.X.0...8.0................:á¼¹Á
...................w..................pÜê±¹Á
...................w..................þ ë....ç ë..Z±ç
ë..............h.............(.8..8.è...è............7°......='§¸ÁpÜê±¹ÁpÜê±¹Á:á¼¹Á.ð.......è......
.......='§¸ÁpÜê±¹ÁpÜê±¹ÁpÜê±¹Á.ð.......è......
.......!`ë....þ
ë............(..........h.............(...(.....................èÚü°øï"!ë....................¨..........h.............(.@.h.@...8.
...."......ºË.....:á¼¹Á:á¼¹Á:á¼¹Á
...................w..................ʦv»¹Áʦv»¹Áʦv»¹Á
...................w..................=!ë...."!ë...."!ë..Z±..........h.............(.8..8.è...............7°......0¢¤¹Á:á¼¹Á:á¼¹Á:á¼¹Á..............
.......0¢¤¹Áʦv»¹Áʦv»¹Áʦv»¹ÁÀ.......À.......
.......V!ë....=!ë............(..........h.............(...(.....................èÚü°øïa!ë..............................h.............(.8..8.è...............7°......0¢¤¹Á:á¼¹Á:á¼¹Á:á¼¹Á..............
.......0¢¤¹Á:á¼¹Á:á¼¹Á:á¼¹Á..............
.......z!ë....a!ë............(..........h.........Z±..(...(.....................èÚü°øï
!ë....................0..........h.............(..(..¬................Zæ.....9n.....!ë....
!ë....
!ë..............h.............(...(.p.l...°.............'±.....y`.....p.Z.....[.....øè£j¸Áøè£j¸Áøè£j¸Áøè£j¸Á.
......³......
.......A.R.9.5.E.5.~.1...J.P.G.0.0.4.ª!ë....!ë....!ë....¨..........h.............(...(..l...............'±.....y......n.....[.....øè£j¸Áøè£j¸Áøè£j¸Áøè£j¸Á.
......³......
.......A.r.Z±h.i.v.e.0.0.0.0.0.0.0.1.[.1.]...j.p.g.0.Å!ë....ª!ë....ª!ë....H..........h.............(...(.................¶Ë.....FILE0..ðaUë......8..è......Ô!ë....Å!ë....Å!ë....0..........h.............(..(..È.........................y.....à!ë....Ô!`ë............(..........h............
.(...(.........................p¶ë!`ë....................¨..........h............(.@.h.@...8.
.....z......l.....nã¼¹Ánã¼¹Ánã¼¹Á
...................l..................~¬¼¹Á~¬¼¹Z± such as
applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
#
# The mod_mime_magic module allows the server to use various hints from
the
# contents of the file itself to determine its type. The
MIMEMagicFile
...
----------------------------------------------------------
The size of the files is always correct.
Previous Comments:
------------------------------------------------------------------------
[2002-02-19 04:53:41] wez@php.net
You're not using the auto-fit image to window option
in IE 6 are you?
------------------------------------------------------------------------
[2002-02-19 03:11:00] khoukaz@web.de
I use a script like the following for downloading files (images, ascii,
...) :
<?
$link = $save_as_name = "test.tif"; // or *.bmp, *.txt, ...
$size = filesize($link);
header("Content-Type: application/octet-stream");
header("Content-disposition: inline; filename=\"".$save_as_name."\"");
header("Content-Length: $size");
header("Content-Transfer-Encoding: binary\n");
readfile($link); // or fpassthru instead of readfile
//$fp = fopen($link, "r");
//fpassthru($fp);
//fclose($fp);
?>
Under Win NT/2000 it works fine, but under XP i get a distorted image
after downloading and opening the file. Also text files differ from the
original one.
I use Apache 1.3.22 and PHP 4.1.1 as module.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15613&edit=1