I have a image upload tool written in php.
Users may chose a file, and it gets uploaded with a certain filename, then if the user regrets chosing that file they may click the file-input and upload another file instead, BUT THE FILENAME IS THE SAME, so the browser caches the first image uploaded. And instead of the second image the browsers display the first one instead, even though it’s another image uploaded.
Kindof hard to explain…
How can I solve this?
Thanks
Either disable caching of images in your web server or append a random query string to the
srcof your image.By “random query string” I mean that you append something that changes on every request to the URL of the image.
Something like this:
Time () returns the current TIMESTAMP and will change on every request, and so the URL will always be different and thus forcing the browser to download the image every time.