PHP function to list the files in the given path. List files from a directory with this php functions as link, so that you can open the files in new tabs.
function listFiles($path) {
if(is_dir($path)) {
if($handle = opendir($path)) {
while(($file = readdir($handle)) !== false) {
if($file != "." && $file != ".." && $file != "Thumbs.db") {
echo '<a target="_blank" href="'.$path.$file.'">'.$file.'</a><br>'."\n";
}
}
closedir($handle);
}
}
}
function listFiles($path) {
if(is_dir($path)) {
if($handle = opendir($path)) {
while(($file = readdir($handle)) !== false) {
if($file != "." && $file != ".." && $file != "Thumbs.db") {
echo '<a target="_blank" href="'.$path.$file.'">'.$file.'</a><br>'."\n";
}
}
closedir($handle);
}
}
}
No comments:
Post a Comment