Minggu, 01 November 2015

Php : How To Get File Extension From Directory Using Php

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>";
        }
    }
}





                     
php files extensions


Bagikan

Jangan lewatkan

Php : How To Get File Extension From Directory Using Php
4/ 5
Oleh

Subscribe via email

Suka dengan artikel di atas? Tambahkan email Anda untuk berlangganan.