PHP function to read how many files there are in a folder. $dir = ./pic;
For example, if there is a Pic folder with 100 pictures in it, the following function can get the total number of 100
$handle = opendir($dir);
$i = 0;
while(false !== $file=( readdir($handle))){
if($file !== . || $file != ..){
$i ;
}
}
closedir($handle );
echo $i;
?>