JSFiddle - React, Tailwind, and code Playground
HTML
<form name="upload-form" id="upload-form" action="upload-information.php" enctype="multipart/form-data" method="post">
<input type="file" name="dealers_csv" id="dealers_csv" required="required" data-message="Please attach the mcust.csv file.">
<button type=\"submit\" name=\"Submit\" id=\"Submit\" class=\"csbutton-color upload-button\" style=\"margin-right:10px;\" >Submit files</button>
</form>
JavaScript
$(document).ready(function() {
$("input#dealers_csv").on("change", function() {
var dealers = $("input#dealers_png");
var arrfilepath = dealers.val().split("\\");
var filename = arrfilepath[arrfilepath.length - 1];
alert(filename);
if (filename != "mcust.csv") {
alert("Wrong file!");
dealers.val('');
}
});
});