as it turns out that I have a form to send with ajax which contains a series of fields plus an image and I do not know how to send the image for the server to process, I put the code that I've been carrying so far ... Send it to me everything is correct except the image that I do not know ...
$(document).ready(function() {
$( "#anadir" ).dialog({
autoOpen: false,
resizable: false,
modal: true,
buttons: {
"guardar": function() {
$.get("peli.php", {
titulo : $("#atitulo").val(),
director : $("#adirector").val(),
fecha: $("#afecha").val(),
idgenero: $("#agenero").val(),
operacion: "nuevo"
},function(data,status){
$("#listar").html(data);
})//get
$(this).dialog( "close" );
},
"Cancelar": function() {
$(this).dialog( "close" );
}
}//buttons*/
});
//accion añadir pelicula
$(document).on("click","#anadirBoton",function(){
$("#formularioanadir")[0].reset();
$( "#anadir").dialog("open");
}); //fin añadir pelicula
}
<form id="formularioanadir" enctype="multipart/form-data">
titulo pelicula: <input type="text" id="atitulo" name="titulo" value="" required/><br>
director: <input type="text" id="adirector" value="" required /><br>
genero: <select id="agenero">
<?php
$consulta = "SELECT idGenero, genero
FROM genero";
$res = $lnk->query($consulta);
while ($fila2 = $res->fetch_object()){?>
<option value="<?= $fila2->idGenero?>"><?= $fila2->genero?></option>
<?php } ?>
</select>
<br>
fecha: <input type="text" id="afecha" value="" required/>
imagen <input type="file" id="afile" value="" required/>
<!--<input type="file" name="file" value="subir archivo">-->
</form>