JSFiddle - React, Tailwind, and code Playground

HTML

<form>
<input type="file" id="file"/>
<input type="text" id="filename" readonly="readonly"/>
<input type="submit"/>
</form>

CSS

input {
    display: block;
    width: 100%;
}

JavaScript

$("#file").bind("change", function() {
    var fn = $("#file").val().replace(/\\/g, "/").split("/").slice(-1);
    $("#filename").val( fn );
});