Listing files from a directory
| From: | Martin E. Koss | Date: | Tue, 21 Aug 2001 15:42:58 +0000 |
| Subject: | Listing files from a directory | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-63720@lists.php.net to get a copy of this message | ||
I am trying to find a way to list files alphabetically.
<?
// list images in a drop down list
$Dir = "../Prod-Images/Thumbnails";
$mydirectory = opendir("$Dir");
while($entryName = readdir($mydirectory)) {
if ($entryName[0] != "." && $entryName != "." && $entryName !=
".." &&
$entryName != "WS_FTP.LOG" && $entryName != "NA.gif" &&
$entryName !=
"NA.jpg") {
PRINT "<option value=\"$entryName\">" .
"$entryName</option>\n";
}
}
closedir($mydirectory);
?>
I've looked through old messages on the subject but even though on Win32 it
lists in the right way but not on the Apache Webserver.
Thanks.
Martin.