JSFiddle - React, Tailwind, and code Playground

by Ray Mak

HTML

<input class="image-uploader" type="file" accept="image/*" capture="camera" multiple="multiple">
<a href="#" class="image-show">Click here</a>

JavaScript

//$(".image-show").on("click", function() {
//  var image = $(".image-uploader");
//  var filename = $('input[type=file]').val();
//  $(image.files).each(function(index){
//      console.log(index);
//  })
// })

// Variable to store your files
var files;

// Add events
$('input[type=file]').on('change', prepareUpload);

// Grab the files and set them to our variable
function prepareUpload(event)
{
  files = event.target.files;
  console.log(files);
}