Re: getting directory info
| From: | Wm | Date: | Wed, 28 Aug 2002 17:03:19 +0000 |
| Subject: | Re: getting directory info | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114388@lists.php.net to get a copy of this message | ||
This is giving me a parse error:
<?php $path = '/usr/local/...full.path.snipped.../httpdocs/thumbnails/';
$dir = opendir($path) or die("Could not open $dir");
while ($file = readdir($dir)){
if (stristr($file, 'jpg') || stristr($file, 'jpeg')){
echo "<A HREF=/enlargements/$file>$file</A><BR>\n";
}
}
?><BR>
This is the only PHP on the page, so it arguably has to be in the above...
:-(
Wm
"Richard Lynch" <rich@phpbootcamp.com> wrote in message
news:php.general-114289@news.php.net...
>
> <?php
> $path = '/full/path/to/your/jpeg/dir/'; # Be sure it's world-readable!
> $dir = opendir($path) or die("Could not open $dir");
> while ($file = readdir($dir)){
> if (stristr($file, 'jpg') || stristr($file, 'jpeg')){
> echo "<A HREF=$file>$file</A><BR>\n";
> }
> }
> ?>