force a web browser NOT to cache images


The problem happens when the administrator wants to change the picture. He would just have to hit the “browse” button, pick a new picture and press ok. And this works fine.

Once the image is uploaded, back-end  handles the upload and reloads the form properly.

The problem is that the image shown does not get refreshed. The old image is still shown, even though the database holds the right image. (fact that the IMAGE IS CACHED in the web browser).


The problem is random strings can collide. You can use:

<img src="picture.jpg?1222259157.222" alt="">

where “1222259157.222” is the current time on the server.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s