
 <?php

if(isSet($_POST["btn_grabar"])){
   include_once 'upload_file.php';
  $id =  $_POST['id'];
   include_once("../php/config.php");
    if($targetFilePath==""){$targetFilePath="thumbnail2.png";}
    mysql_query("update productos
      set size='".$targetFilePath."'
       where id_producto='".$_POST['id']."'") or die(mysql_error());
	   
	    mysql_query("update inventario
      set foto='".$targetFilePath."'
       where codigo='".$_POST['codigo']."'") or die(mysql_error());
	   
   echo "<center><span class='text-primary'><i class='bi bi-check'></i> Foto de producto registrada...</span></center>";
  echo "<script>setTimeout(function(){ window.close(); opener.ver($id);},2000)</script>";
  }

?>