0

The following script works fine for the current directory:

<?php    
$ignore = array ('.', '..', '.DS_Store', 'index.php');
    $num_ordnernamen = array ();
    if ($handle = opendir('./')) {
    while (false !== ($entry = readdir($handle))) {
        if (!in_array($entry, $ignore) && is_dir($entry)) {
        array_push($num_ordnernamen, $entry);
        }
    }
    }
    print_r ($num_ordnernamen); 
?>

, it returns the array as it should:

Array ( [0] => firstfolder [1] => secondfolder )

It does, however, not work for

if ($handle = opendir('../')) //or
if ($handle = opendir('..')) //or
if ($handle = opendir('../..'))

… or anything else I try to get one level up. What am I missing here?

user1293977
  • 159
  • 9

1 Answers1

0
  • Have you permissions to read parent directory?
  • Have you error reporting active?
  • There are directories in your parent directory? (your code print only directories)
Luca Rainone
  • 16,138
  • 2
  • 38
  • 52