JSFiddle - React, Tailwind, and code Playground

by borisjavier

HTML

<h2>Upload images ...</h2>
 
<input type="file" id="uploadfiles" multiple="multiple" />
 
<div id="gallery"></div>

CSS

#gallery .thumbnail{
            width:150px;
            height: 150px;
            float:left;
            margin:2px;
        }
        #gallery .thumbnail img{
            width:150px;
            height: 150px;
        }

JavaScript

var uploadfiles = document.querySelector('#uploadfiles');
uploadfiles.addEventListener('change', function () {
    var files = this.files;
    for(var i=0; i<files.length; i++){
        uploadFile(this.files[i]); // call the function to upload the file
    }
}, false);