troubleshooting Question

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

Avatar of Hugh McCurdy
Hugh McCurdyFlag for United States of America asked on
PHPWeb Browsers
2 Comments1 Solution3260 ViewsLast Modified:
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
StingRaY

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros