JSFiddle - React, Tailwind, and code Playground

HTML

<input type="file">

JavaScript

$('input[type="file"]').change(function(){
    var filename = this.value.match(/[^\\\/]+$/, '')[0];
    alert(filename);
});