Posted By

scalhoun2005 on 03/21/09


Tagged

php list file


Versions (?)

Display file list within Folder


 / Published in: PHP
 

  1. <?PHP
  2.  
  3. $folder = "myFolderName/";
  4. $handle = opendir($folder);
  5.  
  6. # Making an array containing the files in the current directory:
  7. while ($file = readdir($handle))
  8. {
  9. $files[] = $file;
  10. }
  11. closedir($handle);
  12.  
  13. #echo the files
  14. foreach ($files as $file) {
  15. echo "<a href=$folder$file>$file</a>"."<br />";
  16. }
  17. ?>

Report this snippet  

You need to login to post a comment.