Php : How To Use Scandir To Show Files Names

Php Code : How To Show Filenames Using Scandir

________________________________________________________


In this Php Tutorial we will Learn How To Use Scandir To Display Files Names 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);
    print_r($files);
    echo"<br>";
    for($i = 0; $i < count($files); $i++)
    {
        if($files[$i] != '.' && $files[$i] != '..')
        {
            echo "File $i -> $files[$i]<br>";
        }
    }
}




                     
php using scandir

Share this

Related Posts

Previous
Next Post »