Cordial Greeting,
I hope you can help me, what I want to do is make mandatory a "file" type input.
<form method="POST" id="frm_contact" name="frm_contact" enctype="multipart/form-data">
<input type="file" id="1" name="1" class="form-control-file">
<input type="submit" class="btn btn-primary" id="enviardoc" value="Enviar Documentos">
</form>
Since I capture it and send it through AJAX, but I want it to be mandatory.
<script type="text/javascript">
$(function(){
$("#frm_contact").on("submit", function(e){
e.preventDefault();
var f = $(this);
var formData = new FormData(document.getElementById("frm_contact"));
$.ajax({
url: "DocumentosApro.php",
type: "POST",
dataType: "html",
data: formData,datos,
cache: false,
contentType: false,
processData: false
})
.done(function(res){
alert(res);
location.reload();
});
});
});
</script>
It should be noted that the file is sent well, it does not load a file, it does the function, but I want it to be obligatory ..
Thanks