I have a field for uploading PDF documents, when appending a document the PDF icon appears, however I am using multiple upload and only one icon appears when it would be ideal for an icon to appear for each file attached, I know it is possible but I do not have much knowledge of Js, could anyone help?
Code: HTML
<label id="timg" for="upload-photo">Upload <i class="fa fa-folder-open" aria-
hidden="true"></i></label>
<input type="file" multiple id="upload-photo" required accept=".pdf, application/pdf">
<div id="thumbs">
<img src="" id="pdfimg" style="display: block; width: 50px; height: 50px;"/> </div>
JS
const icons = {
'application/pdf': 'http://iconbug.com/data/5b/507/52ff0e80b07d28b590bbc4b30befde52.png',
}
const input = document.querySelector('#upload-photo');
const image = document.querySelector('#pdfimg'); //Script PDF MultipleUpload
input.addEventListener('change', function() {
const tipo = this.files[0].type;
image.src = icons[tipo];
});