I want to save an image in the database but at the time of saving, if 2 have the same name one replaces the other, as I check that if there is one with that name, I will change the name to the other one.
at the moment like this I have the code:
$Id_u = $_SESSION["Id"];
$clv_e = isset($_POST['clv_e']) ? $_POST['clv_e'] : null;
$seccion = isset($_POST['seccion']) ? $_POST['seccion'] : null;
$foto = isset($_FILES['foto']['name']) ? $_FILES['foto']['name'] : null;
$ruta = isset($_FILES['foto']['tmp_name']) ? $_FILES['foto']['tmp_name'] :
null;
$destino="Fotos/".$foto;
$_SESSION['foto']= $foto;
If($clv_e!=""){
copy($ruta,$destino);
$qry=mysql_query("insert into
registros(clave_electoral,seccion,imagen,estado,Id_usuario) values
('".$clv_e."','".$seccion."','".$destino."','Activo','".$Id_u."');"
);