Forum Moderators: coopster

Message Too Old, No Replies

Image Upload and cache

         

madk

2:24 pm on Feb 20, 2009 (gmt 0)

10+ Year Member



I have an upload script that simply uploads an image and renames it to the users ID. The problem is that when I display the results of the upload, it always shows the cached image since the filename is the same.

Is there anyway I can force a refresh on the results page?

madk

2:35 pm on Feb 20, 2009 (gmt 0)

10+ Year Member



I think I have this solved. When displaying the results I simply add a random variable to the end of the image name.

$rand = rand();
echo "<img src = \"" . $filename . "?r=" . $rand . "\">";

It seems to work and trick the browser into pulling the new image.