- How to list all files of a directory with php.
- Display all files from a folder with php.
This scripts lists all files and folders located at given path.
Script
$path='products/images/'; $handle=opendir($path); while (($file = readdir($handle))!==false){ if ($file!="." && $file!=".."){ echo $file . ', '; } }
Output
img01.jpg, img02.jpg, img05.jpg, img07.jpg, img15.jpg
Leave A comment
Email address is optional and will not be published. Only add email address if you want a reply from blog author.
Please fill required fields marked with *