I have following code :
$(document).ready(function(e) {
$("form").on("submit", function() {
$.post ("upload.php", {
fotos : $("input[type=file]")
}, function(retorno){
alert(retorno)
}
);
return false;
});
});
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script><formmethod="post"
enctype="multipart/form-data" >
<input type="file" id="imagens" name="imagens[]" multiple /> <br />
<input type="submit" value="Enviar" />
</form>
upload.php
<?php
print_r($_FILES);
?>
This code has 2 problems:
A , loose and then reload and not for return false
B) How do I send the file field to jQuery but with all the images selected? Note: in the form that the information of the first image selected in the jQuery array is only coming.