I´m trying to show a preview and name of images before upload it with ajax. I use the File Read API to show the preview and, at the same time, use the ".name" method to show the file name, the problem is that its show me all the preview but all the images have the same name, the last file name. Thanks!
$('input').change(function(){
for (var i=0; i<this.files.length; i++){
var reader = new FileReader()
reader.onload = function (e) {
$('ul').append('<li><img src="'+e.target.result+'">'+this.files[i].name+'</li>')
}
reader.readAsDataURL(this.files[i])
}
})