how to catch a file on form submit event code example
Example 1: js form submit listener
document.getElementById("#myFormId").addEventListener("submit", function(e){
if(!isValid){
e.preventDefault(); //stop form from submitting
}
//do whatever an submit the form
});
Example 2: buttons js before submit
<form id="myform">
...
</form>