Problem uploading and saving an image using krajee fileinput

0

I have a problem uploading and saving an image using fileinput of krajee does not save the image and shows the following error "SyntaxError: Unexpected end of JSON input"  Here I leave the code who can help me I appreciate it

<body>

<div class="container">

    <h3 class="text-center"><strong>Administración de facturas</strong> <i class="fa fa-pencil-square-o fa-2x" id="icono"></i></h3>
    <div class="col-md-12">
        <div class="form-group">
            <!--<input class='filestyle' data-buttonText="Logo" type="file" name="imagefile" id="imagefile" onchange="upload_image();">-->
            <div class="file-loading">
                <input type="file" class="form-control" id="images" name="images" accept='image/*'>
            </div>

        </div>
    </div>

    <script>

        $(document).ready(function(){
            $("#images").fileinput({

                uploadUrl: 'subir.php',

            });
        });

    </script>
</div>
</body>

And this is the php that saves the image:

$images = mysqli_real_escape_string($connImg, $_POST['imagen']);
                    if(get_magic_quotes_gpc()) {

                            $images = stripslashes($images);
                        }

                    //$next_increment = $data['Auto_increment'];
                    $nombreLogo = "logoPrueba2";
                    //$code = $next_increment.$alea;
                    $type = 'jpg';
                    $rfoto = $_FILES['imagen']['tmp_name'];
                    $name = $nombreLogo.".".$type;
                    $ruta= 'soporteSalud/sandbox/imagenes/'.$name;
                    if(is_uploaded_file($rfoto))
                    {
                      $destino = "imagenes/".$name;
                      $nombre = $name;

                      copy($rfoto, $destino);
    
asked by robinson horta 25.04.2018 в 18:10
source

0 answers