Last post Nov 30, 2014 12:37 PM by thsman
Nov 29, 2014 05:12 PM|thsman|LINK
I have a page where users upload images. The images upload fine. They go into a gallery of thumbnails and they appear correctly. An image can be selected from the gallery and a button clicked to open an image editor with the selected image. All working fine.
The image can be manipulated in a few different ways and then saved to the server where it now appears in the thumbnail gallery. This too is fine.
The user can select an image from the thumbnails and click another button to open it in image control. This is where things have been getting hairy.
If the image was in the gallery's target folder and has not been edited when the page was first loaded then it opens fine in the image control. But if the image has been edited in the image editor and then chosen then the previous version of the image is
loaded in the image control. The previous version NO LONGER EXISTS on the server as it was saved with the same name as the original. Yet the browser continues to show the original image.
After many hours mucking about with my ajax settings I discovered that if I just rename the edited version of the file when it is saved after editing it can be selected and WILL load into the image control.
I'm left with the conclusion that the original version of the image is somehow being loaded from the browser's cache.
So is there a way to find it and delete it?
Nov 30, 2014 05:59 AM|Mikesdotnetting|LINK
You can't delete anything fro ma browser's cache, but you can force the browser to retrieve the image again by appending a querystring value to the url for the image. Usually, peeps add a timestamp:
image1.ImagUrl = "/images/SomeImage.jpg?" + DateTime.Now.ToString();
The browser sees a different value for the query string each time and treats the request as different, so won't show a cached version.
Nov 30, 2014 12:37 PM|thsman|LINK
Thank you very much.