Save a profile photo stored in a database in a SESSION variable and display it

0

I tried to do it that way but it gives me eror

$consulta="Select * from usuario where nickname='$usuario' and pass='$pass2'";
$resultado=mysqli_query($conexion,$consulta);
$filas=mysqli_num_rows($resultado);
$row=mysqli_fetch_array($resultado);

 $_SESSION["foto"] = $row["foto_perfil"];

$imagen = $_FILES['imagen']['name'];

$ruta = "../subidos/" . $_FILES['imagen']['name']; 
            $resultado = @move_uploaded_file($_FILES["imagen"]["tmp_name"], $ruta); 
    
asked by Carlos Bonilla 20.06.2017 в 17:49
source

1 answer

0

The problem is that in src you are only pointing to the name of the image you should put the path where you store the image, staying like this:

<li><img src="../subidos/<?php echo $_SESSION["foto"] ?>" alt="" id="img"></li>
    
answered by 20.06.2017 / 18:00
source