I have an application where I upload images dynamically and show them in the same page via the given script.
document.getElementById("picture").innerHTML = "<img src='absolute_server_url'/>";
Image name also remains same. I mean when I upload a new image I name that image same as the previous one. May be this will create a problem.
As you're uploading the image to the same filename this image will be potentially cached on the client.
You can get around this by cache-busting.
The simplest method in your example is to attach the current date/time as a query string.
Furthermore rather than use
innerHtml it would be better to build your
img element and set the
var img = document.createElement("img"); img.src = "absolute_server_url?dt=" + Date.now(); document.getElementById("picture").appendChild(img);