Forum Moderators: coopster

Message Too Old, No Replies

PHP Force Content Refresh

         

username

5:21 am on Dec 8, 2008 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hi all,

I have just finished building in an image upload facilty. It posts to the same page upon submission, and then uploads the file after checking. The trouble I am having is that when the file is processed, and uploaded, the preview thumbnail shows the cached previous version. Is there a way to force the page to show the new version without a CTRL F5?

Sekka

12:20 pm on Dec 8, 2008 (gmt 0)

10+ Year Member



Try adding a random query onto the end of the image URL,

e.g. <img src="/path/to/my/image.jpg?<?php echo rand(1,999999); ?>" .../>

This will give you something like /path/to/my/image.jpg?92379. This can help caching issues.

username

3:45 am on Dec 21, 2008 (gmt 0)

10+ Year Member Top Contributors Of The Month



Brilliant idea. Worked like a charm. So simple, yet so effective. Great idea!