Skip to content Skip to sidebar Skip to footer

Image Src Doesnt Change After Upload

i am making an upload with Ajaxupload plugin and i am using this function in OnComplete event of ajaxupload; function degis(){ var a = ''; document.getEleme

Solution 1:

Based on your edits and comments above, I think you need something like this:

function junk() {
    return (new Date()).getTime() + Math.round(Math.random());
}

function degis() {
    var img = document.getElementById("imga");
    if (img) {
        img.src = "../artwork/<?php echo $id; ?>/logo.jpg?nocache=" + junk();
        img.style.width = "500px";
        img.style.height = "175px";
    }
}

Your previous attempt to bypass the cache doesn't work because your "dummy" value is the same each time. By use of a junk() function, as above, you get a different random value each time, ensuring that the image cannot be cached.


Post a Comment for "Image Src Doesnt Change After Upload"