Jump to content

How to get the number of jpeg files on a folder ?


2levelsabove

Recommended Posts

Just use something along the lines of:

 

<?php
$path = "./images/";
$dh = opendir($path);
$NumOfFiles = 0;
while ($file = readdir($dh))
{
  if(eregi("(.*\.jpg)",$file))
  {
    $NumOfFiles++;
  }
}
closedir($dh);
echo $NumOfFiles;
?>

 

It's untested but it should work, if my memory serves :P haven't done php in a while.

 

~ Chocopi

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.