Re: Reading from a dir.
| From: | Sqlcoders.com Programming Dept | Date: | Sun, 09 Jun 2002 00:24:43 +0000 |
| Subject: | Re: Reading from a dir. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101275@lists.php.net to get a copy of this message | ||
Try...
<?
//$dirname should contain the directory name including it's full path...
$handle=opendir($dirname);
while ($file = readdir($handle)){
echo("$file is located in the $dirname directory");
}
?>
HTH,
Dw.
Sqlcoders.com Dynamic data driven web solutions
----- Original Message -----
From: "Steven Mallett" <steve@opensourcedirectory.com>
To: "php-general" <php-general@lists.php.net>
Sent: June 08 2002 07:23 AM
Subject: [PHP] Reading from a dir.
> Is there another way to read the files from a directory?
>
> I tried the following:
>
> foreach (glob("*.txt") as $filename) {
> echo "$filename size " . filesize($filename) . "\n";
> }
>
> but get an error whether safe mode is on or off.
>
> I'm just learning as you might guess.
>
> --
> Steve Mallett http://OSDir.com - Stable, Open Source Apps
> steve@opensourcedirectory.com | webmaster@opensource.org
> http://open5ource.net <personal> | With new, all
> powerful, blogging
> action!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>