Php Code: How To Show Files Extension From A Folder Using Php
In this Php Tutorial we will Learn How To Display Files Extensions From Folder Using Php .
I Use In This Tutorial:
- NetBeans IDE .
- XAMPP .
Php Source Code:
<?php
$dir_path = "folder/";
if(is_dir($dir_path))
{
$files = scandir($dir_path);
for($i = 0; $i < count($files); $i++)
{
if($files[$i] !='.' && $files[$i] != '..')
{
echo "File Name -> $files[$i]<br>";
$file = pathinfo($files[$i]);
$extension = $file['extension'];
echo "File Extension -> $extension<br><br>";
}
}
}