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><img id=\"loader\" src=\"../images/loading.gif\" style=\"display:none;\"/>
</form>
JavaScript
$("#dealers_csv").change(function(){
var dealers =$(this).val();
if(!dealers.match(/.*\\mcust.csv$/g)){
alert("Wrong file!" + dealers);
this.value = "";
}
});