Good evening!
I know how to add an image and save it in my Mysql DB, but at the time of doing the UPDATE the image does not replace it.
<?php
session_start();
$conexion = mysqli_connect("localhost", "root", "", "trigoyponque2017");
$id = $_GET['id'];
$titulo = $_POST['titulo'];
$descripcion = $_POST['descripcion'];
$foto = $_FILES["foto"]["name"];
$ruta = $_FILES["foto"]["tmp_name"];
$destino = "../productos/".$foto;
copy($ruta,$destino);
if($foto != ""){
$editar = "UPDATE producto SET titulo= '$titulo', descripcion = '$descripcion' WHERE id= '$id'";
}else{
$editar = "UPDATE producto SET titulo= '$titulo', descripcion = '$descripcion', foto = '$destino' WHERE id= '$id'";
}
$resultado = mysqli_query($conexion,$editar);
if(!$resultado){
echo "ERROR.";
}else{
echo "Producto editado correctamente.";
}
mysqli_close($conexion);
?>
Only the route is visible in my database, but not the photo that has been uploaded.