Hi,
I'm trying to read the image files such as Jpeg in another directory on a server. The code below will locate and list the files but not the image. This only works if this file is in the same directory as the images. This $mydir="/upload/"; is in another directory. This file is in a subdirectory called /main/ and the /upload/ directory is the subdirectory of the root.
I have a separate directory only for the images. Here's the code;
<?
$mydir="/upload/";
if ($handle = opendir($mydir)) {
echo "Files:\n <table><tr><td>Delete</td><td>Filename</td></tr>";
while (false !== ($file = readdir($handle))) {
if($file!="." && $file!="..")
echo "<tr class='mycell'><td><input type='checkbox' name='files[]' value='$files'></td><td><img src='$files'></td></tr>";
}
echo "</table>";
closedir($handle);
}
?>
Again, it sees the files and gives me a list of the names but does not display the images associated with these files.
What am I missing?
Thanks.
I'm trying to read the image files such as Jpeg in another directory on a server. The code below will locate and list the files but not the image. This only works if this file is in the same directory as the images. This $mydir="/upload/"; is in another directory. This file is in a subdirectory called /main/ and the /upload/ directory is the subdirectory of the root.
I have a separate directory only for the images. Here's the code;
<?
$mydir="/upload/";
if ($handle = opendir($mydir)) {
echo "Files:\n <table><tr><td>Delete</td><td>Filename</td></tr>";
while (false !== ($file = readdir($handle))) {
if($file!="." && $file!="..")
echo "<tr class='mycell'><td><input type='checkbox' name='files[]' value='$files'></td><td><img src='$files'></td></tr>";
}
echo "</table>";
closedir($handle);
}
?>
Again, it sees the files and gives me a list of the names but does not display the images associated with these files.
What am I missing?
Thanks.