I hope you can help me, you will see I have the following: A file called index.php with the following code:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style='background-image:url(fondo/wallpaper.jpg);background-attachment:fixed;background-repeat:no-repeat;background-position:50% 50%;'>
<p>
<form action="valida_foto.php" method="POST" enctype="multipart/form-data">
<input type="file" name="foto" id="foto"><br>
<input type="submit" name="enviar" value="Enviar">
</form>
<?php
require_once("clase/conexion.php");
$query = $mysqli->query("SELECT * FROM imagen");
while($res = $query->fetch_assoc()){
echo '<img src="'.$res["foto"].'" width="100" heigth="100"><br>';
}
?>
</body>
</html>
And another file called valida_foto.php :
<?php
require_once("clase/conexion.php");
if(isset($_FILES['foto'])){
$foto=$_FILES["foto"]["name"];
$ruta=$_FILES["foto"]["tmp_name"];
$destino="fotos/".$foto;
copy($ruta,$destino);
$query = $mysqli->query("INSERT INTO imagen(foto) VALUES('$destino')");
header("Location: index.php");
}
?>
And a folder called photos, where the photos that are uploaded will be stored, in this case I just try to save the route in the database, my base is called photos and the table is called < strong> image with the following fields image_id and photo .
The problem that at the time I try to show the photo saved on the server, only shows the following: