I have a form where people can post a housing ad with two pictures. If the user posts two pictures, and then you view there ad, the pics display fine. But, if the user edits/overwrites those pictures (using an edit-ad form) with different ones, the new pictures won't display until the user hits the refresh button on their browser.
I am using a MySQL db to store the path of the images and then copying the actual uploaded images into a folder called "uploads." I then display the image using an <img> tag with the image path.
I know it sounds confusing, but basically it is as follows:
1.) The first image the user has is called 1_01.jpg.
2.) The user then decides to upload a different image to replace the above image.
3.) The new image is also called 1_01.jpg, but when you go to view the new image, you still see the old one, until you hit refresh on your browser. At that point, the new pic displays.
I know it sounds like a memory problem, but I have tried everything to get the old photo out of memory.I have tried refreshing using PHP, HTML, and so on and have had no luck. I also tried to use the HTML META NO-CACHE tag with no luck, any help would be greatly appreciated!
Thanks, Adam
PHP/refresh image problem
Moderator: General Moderators
What will happen if you try:
Code: Select all
header("Cache-Control: no-store, no-cache, must-revalidate");I placed that in my code (in my header.php file that I include in all files), and I have an interesting result. In Netscape (version 7), my problem is fixed, the new pictures display fine. So, I now know that the problem is directly related to Internet Explorer. Thanks for the input, but I don't believe it helped for my problem, but I will leave the code in my files anyway. If you have any other suggestions, please throw them my way.
Thanks again,
Thanks again,
Okay, how about placing these tags right after the end of body tag like this?
(Better to put the same tags in the header section as well)
(Better to put the same tags in the header section as well)
Code: Select all
</BODY>
<HEAD>
<META HTTP-EQUIV="e;Pragma"e; CONTENT="e;no-cache"e;>
<META HTTP-EQUIV="e;Expires"e; CONTENT="e;-1"e;>
</HEAD>
</HTML>I put that in my code, and nothing.... I have tried that one before. My site is at http://www.wcorentals.com if you want to experience the problem first hand. If you create an account, post an ad with pictures, and then edit your ad with new pics you'll see the problem (in IE). I also thought those tags would work, but darn I've got something screwed up.
Where exactly should the "header" tag go? At the very beginning before my include statements, or after the <html> tag, etc...
Thanks a lot for your help!
Where exactly should the "header" tag go? At the very beginning before my include statements, or after the <html> tag, etc...
Thanks a lot for your help!