JSFiddle - React, Tailwind, and code Playground

HTML

<form id="form" action="http://example.com">
    <input type="file" id="file">
</form>

JavaScript

document.getElementById("file").onchange = function() {
    document.getElementById("form").submit();
}