I do not upload image when uploading it to the server

-4

I've been trying to make a code to upload an image to the server folder and the path appears in the database, until now I'm just looking at the variables of name, category and that, but only me load the gif and I do not get the information.

The funny thing is that I'm following a tutorial on YouTube and I've already reviewed the video 10 times but I can not find why it does not work, could someone please tell me why the information does not come out and just upload the gif?

This is the JavaScript code:

$(document).ready(function(){
    $("#insertar-pelicula").submit(insertarDatos)
    function insertarDatos(evento){
        evento.preventDefault()
        var datos = new FormData($("#insertar-pelicula")[0])        
        $("#respuesta").html("<img src='images/cargando.gif'>")
        $.ajax({
            url: 'insertar-datos.php',
            type: 'POST',
            data: datos,
            contentType: false,
            processData: false,
            sucess: function(datos){
                $("#respuesta").html(datos)
            }
        })
    }
})

And this is PHP's:

$conexion = mysqli_connect("localhost", "root", "", "peli");
mysqli_set_charset($conexion, "utf-8");
$nombre = $_POST["nombrePeli"];
$descrip = $_POST["descripcion"];
$genero = $_POST["genero"];
$imagen = $_FILES["imagen"];
echo $nombre." ".$descrip." ".$genero;

So far I had tested the image, but nothing came out, so I put something simpler that was to show me the data of the variables. In theory, after showing me the gif should show me the information, but nothing comes out and I do not know what it could be.

    
asked by user112243 21.12.2018 в 17:30
source

0 answers