List Contents of a Directory


/ Published in: PHP
Save to your folder(s)

To make an image browser, add these lines:

$ext = strtolower(substr("$dirArray[$index]", strrpos("$dirArray[$index]", '.') + 1)); //get file extensions

if ("$ext" == "jpg") { // if file is a jpg

print("$dirArray[$index]<a href=\"$dirArray[$index]\"></a>"); // show image and create link to it

URL: http://www.liamdelahunty.com/tips/php_list_a_directory.php

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.