0
Colleagues.
I have a site where the form is validated with Jquery through a Bootstrap modal and everything is OK the message is sent. However we have included a field file for uploaded files. The problem we’re encountering is that the file doesn’t go to the upload validation page:
<form role="form" class="contact-form" id="contact-form" method="post" enctype="multipart/form-data">
<div id="final" class="form-group invisivel radio">
<div class="form-group">
<label for="Arquivo">Arquivo:</label>
<div class="input-group margin-bottom-sm">
<span class="input-group-addon"><i class="fa fa-upload fa-fw" aria-hidden="true"></i></span>
<input name="Arquivo" class="form-control" type="file" placeholder="Envie arquivo">
</div>
<small id="emailHelp" class="form-text text-muted">Arquivos suportados: PDF, .doc e .docx</small>
</div>
</div>
Jquery
<script>
$('form').submit(function () {
function (d) {
$.post("enviar.php", $(".contact-form").serialize(), function(d) {
$('#success').html(d);
$('#myModal').find(".modal-body").html(d);
$('#myModal').modal('show');
});
return false;
});
</script>
PHP
echo $_FILES['Arquivo']['name'];
How I would take advantage of jquery code for validation with Modal Bootstrap?
Possible duplicate of Upload a file with AJAX
– Woss
Related: Upload does not reach PHP via AJAX with . serialize()
– Woss
Sorry ignorance, but how would I apply inside the modal Bootstrap? The code I passed works, just does not send upload files.
– user24136
And the links I passed do not solve the upload problem? I agree.
– Woss
I don’t know much about jquery and would like to incorporate the link solution into what we already have, because our validation uses the Bootstrap modal. We have other text fields that work and the code you passed seems to be focused on just uploads. Although they have almost the same title, but they are different situations.
– user24136