|
Post by entity on Nov 7, 2005 6:38:24 GMT -8
I have been looking for a certain code now for about a week and a bit, but to no avail. What I am looking for is a code that'll count the files in a directory usng PHP. The reason I need this is because I am designing a gallery, I have my gallery script and its going alright, but the file counting script is the next leap for me to conqour. I would really appriciate any help that somebody posts, I know its quite a lot to ask, but I have relied upon this site and its PHP tutorials page for a lot of things, but saddly, this isn't covered.
Thanks in advance. ------------------------------------------------------------ Also if you'd like to see my gallery script click on the following link: Digi-Port ------------------------------------------------------------
[/size]
Last Edit: Nov 7, 2005 6:47:51 GMT -8 by entity
|
|
|
Post by michael on Dec 28, 2005 5:05:52 GMT -8
Use this code <?php $dr = $_SERVER['DOCUMENT_ROOT'].dirname($PHP_SELF); $hd = open($dr); $cn = 0; while(false !== ($fl = readdir($hd))){ if(is_file($file) && $file !=='.' && $file !=='..'){ $cn++; }} echo $cn; ?>
Last Edit: Dec 28, 2005 5:30:41 GMT -8 by michael
|
|