Posted By

level09 on 08/18/09


Tagged


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

vali29
luman
jcroom
umang_nine
ReeceMarsland


List content of directory


 / 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.