Jump to content

dir jpg and gif


Maverickb7

Recommended Posts

I would like to list all files within a directory that end with .jpg and .gif. I have the below code at the moment and would appreciate if someone could help me out. Thanks!

<?php
if ($handle = opendir('.')) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            echo "$file\n";
        }
    }
    closedir($handle);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/45507-dir-jpg-and-gif/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.