I have the following error. When I try and access the files in a directory contained in the variable "$dir" I get "Warning: Supplied argument is not a valid Directory resource" in other words my "$handle = opendir('$dir');" is not able to read the variable "$dir".
Is this something to do with global variables? I have done the $GLOBALS[$dir] but still having problems.
Here is my complete script.
TX for the help!!
while ($entry_name = readdir($current_directory))
{
if (ereg (".", $entry_name))
{
continue;
}
if(is_dir($orig_dir.$entry_name))
{
print "$entry_name\n";
$dir = "$entry_name";
$first = array(); //creates a blank array
$handle = opendir('$dir');
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
array_push( $first, $file ); //pushes all files into the first array
}
}
closedir($handle);
foreach ($first as $val)
{
print "<li><a href='index.php?file=$val'>$val</a></li><br>";
}