0
I used the function file_exists
and she even finds the file.
The problem is that when it does not find, the message that does not exist is not displayed (it does not enter Else).
<?php
$email = $v->email;
$email = strstr($email, '@', true);
$url = base_url();
foreach (array('png', 'jpg', 'gif') as $ext) {
if (!file_exists("./uploads/{$email}." . $ext)) {
continue;
}
$email = "$email.$ext";
$filename = "./uploads/{$email}";
if (file_exists($filename)) {
echo "O arquivo $filename existe";
} else {
echo "O arquivo $filename não existe";
}
echo "<img alt='' class='left avatar-comentario' src=\"" . $url . "uploads/$email\" maxwidth=\"300\" ,maxheight=\"400\" />";
break;
}
?>
Thank you Anderson, your reply helped me!
– viniciussvl