Does anyone have the code to display how many files are in a folder on your website? Example if i stored my images in a folder called images: We currently host: 80 photos Any idea how to do this? Thanks Joseph
Probably just want to read the file names in the directory in a loop until there are no more to read (counting them along the way of course)... http://www.php.net/manual/en/function.readdir.php
<?php //directory path $dir = $_SERVER['DOCUMENT_ROOT'].dirname($PHP_SELF); //open the directory $open_dir = opendir($dir); //reset the counter $count = 0; //loop through the directory while (false !== ($file = readdir($open_dir))) { //count files but remove .. and . if (is_file($file) && $file !== '.' && $file !== '..') { $count++; } } echo $count; ?> PHP: This should do it for you as well.