tags:

views:

156

answers:

2

Is there a way to "uncache" an image file? I don't want to add a cache buster to the image src (it is a user avatar image) since I don't want to have to load the image on every page view. Basically the problem is that when a user uploads a new avatar, it won't show up until they reload the page since the old one is still in cache with the same filename.

+1  A: 

Make the filename unique (such as a GUID). When the user uploads a new image, save it with a new GUID as the filename:

save to => "avatars/bd25298e-b537-48e1-a002-35c26e0536be.gif"
Rex M
Well the way I have everything setup is that the filename is just in the form of username.png.
James Simpson
@James that's the problem. You need to add a column to your users table (or equivalent) for "avatar" which stores the filename.
Rex M
A: 

pass a unique key (randomly generated key) when upload a file name .

Abhisheks.net