note 81897 added to function.readdir
| From: | dbzfanatic_1 at hotmail dot com | Date: | Tue, 18 Mar 2008 17:03:47 +0000 |
| Subject: | note 81897 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137169@lists.php.net to get a copy of this message | ||
Here's an easy way to output the contents as a list of download links.
<?php
$count = 0;
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {$count++;
print("<a
href=\"".$file."\">".$file."</a><br />\n");
}
}
echo '<br /><br /><a href="..">Return</a>';
closedir($handle);
}
?>
and simply use $count to list the overall number of files.
----
Server IP: 208.69.120.35
Probable Submitter: 68.114.195.84
----
Manual Page -- http://www.php.net/manual/en/function.readdir.php
Edit -- https://master.php.net/note/edit/81897
Del: integrated -- https://master.php.net/note/delete/81897/integrated
Del: useless -- https://master.php.net/note/delete/81897/useless
Del: bad code -- https://master.php.net/note/delete/81897/bad+code
Del: spam -- https://master.php.net/note/delete/81897/spam
Del: non-english -- https://master.php.net/note/delete/81897/non-english
Del: in docs -- https://master.php.net/note/delete/81897/in+docs
Del: other reasons-- https://master.php.net/note/delete/81897
Reject -- https://master.php.net/note/reject/81897
Search -- https://master.php.net/manage/user-notes.php