Skip to content

Instantly share code, notes, and snippets.

@MilkZoft
Created February 1, 2012 01:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MilkZoft/1714381 to your computer and use it in GitHub Desktop.
Save MilkZoft/1714381 to your computer and use it in GitHub Desktop.
codejobs - List files - PHP
<?php
function list_files($dir) {
if(is_dir($dir)) {
if($handle = opendir($dir)) {
while(($file = readdir($handle)) !== FALSE) {
if($file !== "." and $file !== ".." and $file != "Thumbs.db") {
echo '<a target="_blank" href="'. $dir . $file .'">'. $file .'</a><br>'."\n";
}
}
closedir($handle);
}
}
}
/*
To use:
<?php
list_files("images/");
?>
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment