I would like to have the images selected using the files input to appear under the input so that the user will have a visual cue about what he's going to upload. I've partially succeeded as my code does display the image, however, it displays only one image instead of all selected images.
I assume I'd need to use for loop and loop as many times as I have selected images in the input, however, I'm not sure how to get the amount of images into the select.
function displayInputImage(input) {
var reader = new FileReader();
var x = document.createElement("img");
reader.onload = function(e) {
x.setAttribute("src", e.target.result);
}
reader.readAsDataURL(input.files[0]);
x.className = "new-avatar-picture";
$('.upload-btn-wrapper').append(x);
}
$(".upload-input").change(function(){
displayInputImage(this);
});