JSFiddle - React, Tailwind, and code Playground

by dsbonev

HTML

<input type=file />

JavaScript

(function () {
    'use strict';        document.querySelector('input[type=file]').addEventListener('change', function (event) {
    var target = event.target,
      file = target.files[0];
    
    if (!file) return;
            
            var url = URL.createObjectURL(file);
            var image = new Image();
            image.src = url;
            image.onload = function () {console.log(file.name, image.width, image.height);}
            
  });
})();