I'm doing a very simple "news load" and when I speak of simple, believe me it's very simple ... I have a table where I load the titles, and a little picture on the left and a summary. It has more to the right a button where the user enters to read the complete news ... The model is more or less like this:
Now, the pictures that I am going to upload are in a folder whose route is "../../images/news" and the images are numbered by the id of the news. Simple up there. Now, when I load that table of the news, I look in the directory of the images if this photo corresponds to that news. I do the following:
<?php
$nombre_fichero = "../../images/noticias/".$row['id'].".jpg";
if (file_exists($nombre_fichero)) {
$archivo = $row['id']."jpg";
} else {
$archivo = "imagen.png";
}
?>
<td><img class="ui tiny image" src="../../images/noticias/" <?php $archivo; ?>"</td>
The idea is that if you can not find the corresponding photo, you would "upload" a standard image of the type:
now well ... I think that what I'm doing would not be working because it does not load ... well, I think I'm passing a text string and not a "file" ... can it be?