RE: [PHP] read filenames from dir
| From: | Phil Spitler | Date: | Thu, 26 Jul 2001 13:43:26 +0000 |
| Subject: | RE: [PHP] read filenames from dir | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59740@lists.php.net to get a copy of this message | ||
This should do it for you.
<?
$path = "THE DIRECTORY YOU WISH TO LIST THE FILES FROM";
$d = dir($path);
while ($entry=$d->read()) {
if ((!is_dir($path.$entry)) AND ($entry !== ".") AND ($entry !== "..")){
echo "<a href='$entry'>$entry</a><br>\n";
}
}
$d->close();
?>
-----------------------------
Phil Spitler [Vice President]
Web Hut Design, Inc.
c 704-451-1324
mailto:phil@webhutdesign.com
> -----Original Message-----
> From: news.php.net [mailto:dr.bob_nospam@extent.nl]
> Sent: Thursday, July 26, 2001 9:20 AM
> To: php-general@lists.php.net
> Subject: [PHP] read filenames from dir
>
>
> hi,
> I want to read the filenames in a specific dir (running Linux)
> and echo the
> names as link in my browser.
> Which functions/commands can I use for this?
> What are the security risks?
>
> TIA,
> Dr.Bob
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>