JSFiddle - React, Tailwind, and code Playground

HTML

<input type="file" id="file" />

JavaScript

var _URL = window.URL || window.webkitURL;

$("#file").change(function(e) {
    
    var image, file;

    if ((file = this.files[0])) {
       
        image = new Image();
        
        image.onload = function() {
            
            alert("The image width is " +this.width + " and image height is " + this.height);
        };
    
        image.src = _URL.createObjectURL(file);


    }

});