have looked up what my issue would be with filesize()
that cant read the file size from a file in sub directory. Also file_exists()
and is_readable()
gave negative feedback. Directory and file permission 777. The best is that is showing the image and get an echo of the file directory.. Least but not last, files are owned by same user.
$filename = '/media/photo.jpg';
// Getting error filesize(): stat failed for /media/photo.jpg
echo $filename . '<br>' . filesize($filename) . ' bytes<br>';
// File path is echod with else "The file /media/photo.jpg is NOT ok.
if (file_exists($filename) && is_readable($filename)) {
echo "The file $filename is ok";
} else {
echo "The file $filename is not ok<br>";
}
// Image is rendered and show on browser.
echo '<img src="'.$filename.'"/>';