Aquí tienes un ejemplo de como se lista el contenido de una carpeta, pero si en vez de listarlo calculas la longitud del array de resultados tendrás el número de archivos
Código PHP:
Ver original<?
//define the path as relative
$path = "/home/httpd/vhosts/spoono.com/httpdocs";
//using the opendir function
$dir_handle = @opendir($path) or
die("Unable to open $path");
echo "Directory Listing of $path<br/>";
//running the while loop
while ($file = readdir($dir_handle)) {
if($file!="." && $file!="..")
echo "<a href='$file'>$file</a><br/>";
}
//closing the directory
?>