JSFiddle - React, Tailwind, and code Playground

by Mukul kant

HTML

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<div class="form-group">
                <label for="uploadFile">File input</label>
                <input type="file" id="uploadFile">
                    <button>Get filename<button>

JavaScript

$("button").click(function() {
    var fullPath = $("#uploadFile").val();
    
    var filename = fullPath.replace(/^.*[\\\/]/, '');
    
    alert(filename);
});