I need to reload the page when an image uploaded because the page keeps displaying the old image. Is there a better way to accomplish it then putting the following:

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 

// always modified 
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 

// HTTP/1.1 
header("Cache-Control: no-store, no-cache, must-revalidate"); 
header("Cache-Control: post-check=0, pre-check=0", false); 

// HTTP/1.0 
header("Pragma: no-cache");

    What I would probably try to do if possible is to rename the image each time it's changed, such as making the current time() value part of the name. That way browsers can cache it unless/until it is changed and therefore has a new name. This would assume that the src value of the img tag can be dynamically set by your script (such as from a database value).

      Unfortunately I have to recycle the same names...

        Write a Reply...