I am trying to add an image preview for each image being uploaded.
I have successfully displayed a list of image names being uploaded, but I cannot figure out how to add the image preview.
Here is what I got so far:
$(document).on('change.bs.fileinput', '.fileinput', function(e) {
var $this = $(this),
$input = $this.find('input[type=file]'),
$span = $this.find('.fileinput-filename');
$ul = $("div").find('.upload-list');
if($input[0].files !== undefined && $input[0].files.length > 1) {
$span.html('<span>'+$input[0].files.length+' files selected</span>');
$ul.html('<label for="albumImages">Uploading Images</label><ul class="list-group"><li class="list-group-item">' + $.map($input[0].files, function(val) { return val.name; }).join('</li><li class="list-group-item">') + '</li></ul>');
$('.upload-list').show();
$('.album-inputs').show();
} else {
$('.upload-list').hide();
$('.album-inputs').show();
}
});
I want to add the image to the left of the name. Can someone guide me in the right direction?