Posted By

paulgrenwood on 09/23/09


Tagged

php list directory


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

BrianCoyDesign


List Directory Contents


 / Published in: PHP
 

  1. function list_files($dir)
  2. {
  3. if(is_dir($dir))
  4. {
  5. if($handle = opendir($dir))
  6. {
  7. while(($file = readdir($handle)) !== false)
  8. {
  9. if($file != "." && $file != ".." && $file != "Thumbs.db")
  10. {
  11. echo '<a target="_blank" href="'.$dir.$file.'">'.$file.'</a><br>'."\n";
  12. }
  13. }
  14. closedir($handle);
  15. }
  16. }
  17. }

Report this snippet  

You need to login to post a comment.