-
Displaying files in a directory with PHP
Good afternoon everyone,
I need to display files in a directory and have the following code, which works great:
<?php
$dir = "documents/";
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
echo '<a href="documents/'.$file.'">'.$file.'</a><br />';
}
closedir($dh);
?>
The results I get is:
De Beer 01.doc
De Beer 02.doc
.
..
Engelbrecht 01.doc
Can anyone please tell me how to remove the . and .. ?
Any help would be much appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks