JSFiddle - React, Tailwind, and code Playground

HTML

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

JavaScript

document.getElementById("upload").onchange = function(e) {
    var fr = new FileReader;
    
    fr.onloadend = function() {
        alert(fr.result.substring(0, 100));
    };
    
    fr.readAsBinaryString(e.target.files[0]);
};