ID: 15613
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Feedback
Bug Type: Output Control
Operating System: Windows XP (Professional)
PHP Version: 4.1.1
New Comment:
I could solve the problem with binary files by using fread instead of
readfile:
<?
$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");
$fp = fopen($link, 'rb') or print('Could not open file!');
$read = fread($fp, $size) or print('Could not read file');
fclose($fp);
print($read);
?>
But this only works with binary files. With text files a get the same
problems (see above).
Previous Comments:
------------------------------------------------------------------------
[2002-02-20 03:23:36] [EMAIL PROTECTED]
Now i turned implicit_flush in the php.ini to on (see Bug #15245), but
this doesn't matter.
Please let me know, if you need more information.
------------------------------------------------------------------------
[2002-02-19 05:34:01] [EMAIL PROTECTED]
No output buffering, no compression.
------------------------------------------------------------------------
[2002-02-19 05:25:16] [EMAIL PROTECTED]
Yuk!
Do you have output buffering enabled, and/or gzip compression?
(Just to confirm).
------------------------------------------------------------------------
[2002-02-19 05:09:04] [EMAIL PROTECTED]
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.............(...(.....................���<U�g`�....................�..........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.............([email protected].@...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............([email protected].@...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.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/15613
--
Edit this bug report at http://bugs.php.net/?id=15613&edit=1