I have an upload form where the uploaded picture is displayed. This works perfectly in Firefox. Problem is that in Internet Explorer, the image only displays when the page is refreshed. I do not want my users to have to do this, any tips? I tried just about every solution that was given around the web, but nothing works. I tried:

header("Pragma: no-cache");
    header("Cache: no-cache");
    header("Cache-Control: no-cache, must-revalidate");
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

and this:

header('Location: http://www.example.com');

I tried adding a refresh in my actual form tags (onclick="..."), but that was processed too soon after, and it didn't hold my image. (this problem was also only in IE)

This seems like a very common problem, something having to do with keeping the cache. So my question is- why can't I find a solution that works?

Thanks in advance.

6 Years
Discussion Span
Last Post by LELE7

I have an upload form where the uploaded picture is displayed.

Once you upload the picture, what code are you exactly executing? Are you:
a. emitting an <IMG> tag with the path to the newly uploaded image
b. redirecting to the newly uploaded image
c. Other???

If you are doing a or b, instead of pointing to image.gif, try pointing to image.gif?cb=XXX where X is some random number - You can use the time() function to guarantee that it will be different every time:

header( 'Location: http://www.example.com/image.gif?cb=' . time() );
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.