Hi, here is my code so far:
<?php
//List files in chosen directory
$dir = opendir("uploads");
while ($entryName = readdir($dir))
{
$dirArray[] = $entryName;
}
closedir($dir);
$indexCount = count($dirArray);
echo "$indexCount files <br />";
for($index=0; $index < $indexCount; $index++)
{
if ($dirArray[$index] != "." && $dirArray[$index] != "..")
{
$type = filetype($dirArray[$index]);
if ($type == "dir")
{
echo "<img src='dir.png' />";
}
else
{
echo "<img src='file.png' />";
}
echo "<a href='".$dirArray[$index]."'>".$dirArray[$index]."</a> <br />";
}
}
?>
My problem is that I when the indexCount, counts all my files, I just want it to display how many files there are of a chosen extension.
Let's say I just want it to tell me how many files I have of .jpg or .jpg and .png
Can someone help me with this?
Help will be much appriciated.