-4

I have a tree of files like this

  • --Folder1
  • ----File1.1
  • ----File1.2
  • ----File1.3
  • --Folder2
  • ----File2.1
  • ----File2.2
  • ----File2.3 . .

I want to display all folders in combobox, if a chose a folder ; the lists of files of this folder can display in other combobox in HTML/PHP

  • Possible duplicate of [PHP list all files in directory](http://stackoverflow.com/questions/3826963/php-list-all-files-in-directory) – Jonathan Kuhn Apr 18 '16 at 16:21

1 Answers1

1
$dir = 'some directory';
if ($handle = opendir($dir)) {
    while (false !== ($entry = readdir($handle))) {
        if (is_dir($entry) && $entry != "." && $entry != "..") {
            echo "$entry\n";
        }
    }
}

closedir($handle);
yk11
  • 768
  • 4
  • 9