Re: listing the files in the directory

From: Date: Fri, 24 May 2002 18:09:18 +0000
Subject: Re: listing the files in the directory
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-99119@lists.php.net to get a copy of this message
On Saturday 25 May 2002 02:01, _michael wrote: > hi, i'm pretty new to php - i am trying to list/print a list of files and > folders that are on my server: > > from my little knowledge i have got: > > <?php > $dir = "http://mysite.com/"; > $handle = opendir($dir); > while (($file = readdir($handle))) { > if ($file != "." && $file != "..") { > echo "- " . $file . "<br>"; > } > } > ?> > > i keep getting errors - will this code list the files on my site? No. You can only opendir() a local filesystem. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* It's clever, but is it art? */

« previous php.general (#99119) next »