JSFiddle - React, Tailwind, and code Playground
by Rob Janssen
HTML
<body>
<form action="" method="post">
<input id="myfile" type="file" /><input type="button" onclick="alertPath(this.previousSibling);" value="select file and press the button" />
</form>
</body>
JavaScript
function alertPath(elem) {
var f = elem.value.split('fakepath\\');
alert(f[f.length-1]);
}