//Function to return filenames of a particular directory
function GetFileNames($dir) {
if (is_dir($dir)) {
if($dh = opendir($dir)) {
while (false !== ($file = readdir($dh))) {
if ($file != "." && $file != "..") {
$file_names[]=$file;
}
}
closedir($dh);
}
}
return $file_names;
}
//Usage
print_r(GetFileNames("/uploads/"));
No comments:
Post a Comment