/ Published in: PHP
List only certain files in a folder with PHP
Lists only certain files extensions as links on a page
from a defined folder
Lists only certain files extensions as links on a page
from a defined folder
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /* */ //Define directory for files listing //original example //$files = glob('/path/to/dir/*.xml'); //to limit what is displayed you can use a diff listing: //$files = array_diff($files, array('index.php','opendb.php')); foreach ($files as $value) { echo "<a href=http://changetoyoursite/$value>".$value."</a><br>"; } ?>