|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-06-11 14:12 UTC] bondu at iowalab dot com
This script works as expected: <? $filename = "someimage.jpg"; $fd = fopen ($filename, "rb"); echo $contents = fread ($fd, filesize ($filename)); fclose ($fd); ?> Adding sesion start sends bogus header infromation that makes IE think the file is a bitmap. When right clicking on the image, IE thinks the file is of type .bmp and the Protocol is HTML. Does the same thing for all image types. Adding header information in the script does not fix the problem, nor does setting default_mimetype to the "image/jpeg" in the script. I was able to reproduce this on 4 different linux machines running 4.0.2, 4.0.4p1, and 4.0.5 <? session_start(); $filename = "someimage.jpg"; $fd = fopen ($filename, "rb"); echo $contents = fread ($fd, filesize ($filename)); fclose ($fd); ?> PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 00:00:02 2025 UTC |
This works: <? session_start(); $filename = "test.jpg"; $fd = fopen ($filename, "rb"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); Header ("Content-type: image/jpeg"); echo $contents; ?>adding Header ("Content-type: image/jpeg"); does NOT fix the problem. copy the "fixed" script to a new file name, and see that it does not work. you are looking at cached version. IE will cache the mimetype info associated with the image even if you clear your history. I am able to reproduce this consistantly on multiple machinesadding session_cache_limiter("private"); before session_start(); fixed the problem. <? session_cache_limiter("private"); session_start(); $filename = "test.jpg"; $fd = fopen ($filename, "rb"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); Header ("Content-type: image/jpeg"); echo $contents; ?>