list directory files
function folderlist(){ $startdir = './uploadg/'; $ignoredDirectory[] = '.'; $ignoredDirectory[] = '..'; $i=1; if (is_dir($startdir)){ if ($dh = opendir($startdir)){ while (($folder = readdir($dh)) !== false){ if (!(array_search($folder,$ignoredDirectory) > -1)){ if (filetype($startdir . $folder) == "dir"){ $directorylist[$startdir . $folder]['name'] = $folder; $directorylist[$startdir . $folder]['path'] = $startdir; } } } closedir($dh); } } return($directorylist); } $folders = folderlist(); foreach ($folders as $folder){ $path = $folder['path']; $name = $folder['name']; $i++; echo "$i. $name "; } ?> |
No comments:
Post a Comment