Reputation: 105
I can't find the reason why my picture won't show.
<?php
$dir = "/home/ahmed/Desktop/uploaded";
if($opendir = opendir($dir))
{
while (($file = readdir($opendir)) !== FALSE)
{
if ($file != "." && $file != "..")
{
echo "<img src='$dir/$file'><br>";
}
}
}
?>
When I checked the uploaded directory, all images were locked. I gave full permission to every image but my image still won't be displayed. I've been messing around with this for about 30 min and I still cannot find a solution. Any help will be appreciated. Thanks.
Upvotes: 0
Views: 39
Reputation: 1802
You must use a path relative to the site's DocumentRoot
value, if this is currently set to /home/ahmed/Desktop
then your img tag's src value would resolve as uploads/img.jpg
for example.
If you're using Apache the DocumentRoot
is typically defined in the site's Virtual Host config file.
Upvotes: 2