kannan D.S kannan D.S - 1 month ago 9
CSS Question

Jquery image upload same image not uploading issue

am trying to upload multiple images using jquery. but same images are not uploading. how to solve this issue please check my fiddle

$images = $('.imageOutput')
$(".imageUpload").change(function(event){
readURL(this);
});
function readURL(input) {
if (input.files && input.files[0]) {
$.each(input.files, function() {
var reader = new FileReader();
reader.onload = function (e) {
$images.append('<img src="'+ e.target.result+'" />')
}
reader.readAsDataURL(this);
});
}
}


click here for jsfiddle

Answer

if you try to upload the same file, the value of file input does not change. Try to print it out:

    $('.button-2').click(function(){
        console.log($(".list .upload-file").val())
        return false;
    });

Or use this one If you want to upload twice, clear file input value

    $('input[type="file"]').val(null);
 http://jsfiddle.net/cfddream/BF8Gc/