In my application there is a folder name videos. i want to raed all file only of this folder I have done almostly it does not show any folder in folder videos except .DS_St
';
while(($file=readdir($dh)) !== FALSE){
$file = $dir . '/' . $file;
if(!is_file($file) || substr($file, 0, 1) == '.'){
continue;
}
printf('', htmlentities($file));
}
echo '';
closedir($dh);
}
?>
First, if opendir fails, don't continue with junk. It ignores non-files (directories) and files starting with a dot (including ., .., .htaccess, etc.)