Re: read filenames from dir
| From: | Dr.Bob | Date: | Thu, 26 Jul 2001 14:16:03 +0000 |
| Subject: | Re: read filenames from dir | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59745@lists.php.net to get a copy of this message | ||
Thanx Phil, workes great!
Dr.Bob
"Phil Spitler" <phil@webhutdesign.com> wrote in message
news:IBEBKMOFBNDPEMLOLBKBGEAECMAA.phil@webhutdesign.com...
> 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
> >