<?php
session_start();
include "../conexion.php";
include('../include/sesiones.php');

$gar_id=$_POST['gar_id'];
$nameimagen = $_FILES['factura']['name'];
$tmpimagen = $_FILES['factura']['tmp_name'];
$extimagen = pathinfo($nameimagen);
$ext = array("","pdf");
$urlnueva = "../img/img_garantias_clientes/".$gar_id.".pdf";
if(is_uploaded_file($tmpimagen))
   {
        if(array_search($extimagen['extension'],$ext))
           {
                copy($tmpimagen, $urlnueva);
                echo '<div class="alert alert-info alert-dismissable">
                  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                  <strong>Guardado! </strong>Correctamente.
                </div>';
           }
        else 
           {
            echo '<div class="alert alert-danger alert-dismissable">
                  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                  <strong>No se guardo! </strong> Solo se permiten imágenes con formato  pdf.
                </div>';
           }
   }

?>