JSFiddle - React, Tailwind, and code Playground

by Kalu Singh Rao

HTML

<link rel="stylesheet" href="https://dl.dropboxusercontent.com/s/bpuhzgb6dx1yrig/dropzone.css">
<script src="https://dl.dropboxusercontent.com/s/baymnn3vitqu771/dropzone.js"></script>
<form method="post" action="upload-page.php" enctype="multipart/form-data">
  <input name="filesToUpload[]" id="filesToUpload" type="file" multiple="" />
</form>

JavaScript

//get the input and UL list
var input = document.getElementById('filesToUpload');
var list = document.getElementById('fileList');

//empty list for now...
while (list.hasChildNodes()) {
	list.removeChild(ul.firstChild);
}

//for every file...
for (var x = 0; x < input.files.length; x++) {
	//add to list
	var li = document.createElement('li');
	li.innerHTML = 'File ' + (x + 1) + ':  ' + input.files[x].name;
	list.append(li);
}