hi all
I can open a directory/folder and read its contents, the problem I have is if there is a directory under the orginal directory, i cant open and view the contents of the 2nd folder.
here is my code. at the moment im just using if(is_dir()){continue} but the folders are still apearing.
//select the directory to read.
$dir = "H:/Program Files/Apache Group/Apache2/htdocs/test_data/";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
echo "<table align='center'>\n";
while (($file = readdir($dh)) !== false) {
//throwing in a href var so be easier to edit laster on
$href = "<a href=http://localhost/test_data/".$file .">$file</a>";
if($file == "." or $file == ".."){continue;}
//expermintal 1 liner below
if(is_dir($file)){continue;}
echo "<tr>\n";
echo "<td>filename:\t</td>\n<td>$href </td>\n<td>
: filesize:\t " . round(filesize($dir . $file)/1024000) . "MB</td>\n";
}//ends while
closedir($dh);
}//ends if$dh
}//closes if dir
Thanks for reading my post
lozza