Link to home
Start Free TrialLog in
Avatar of Hugh McCurdy
Hugh McCurdyFlag for United States of America

asked on

image/jpg in HTTP response header not working in Internet Explorer

I'm having trouble with this PHP script in Internet Explorer/Win7.  It works fine in Firefox/Win7, Chrome/Win7, Firefox/Linux and Chrome/Linux.

<?php
header('Content-type: image/jpg');

header('Content-Disposition: inline');

readfile('images/tree-red.jpg');
?>

You can see a working example at   http://hugh.tekcities.com/hugh/foo.php

If I use image/png and use a png file or image/gif and use a gif file, it works in all tested browsers including Internet Explorer.  It is only the jpg's that have problems.

What it does is try to download the file instead of display the image.  Not only that, but it thinks the filename is foo.php (or whatever the name of the script happens to be).  But then it downloads the image (not the php file).
ASKER CERTIFIED SOLUTION
Avatar of StingRaY
StingRaY
Flag of Thailand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hugh McCurdy

ASKER

That works.  Thanks.