On Fri, Aug 09, 2002 at 08:58:41AM -0500, §§ Duncan MacLeod §§ wrote:
> I am only being able to list the first
> file in each of the directories.  Not the entire directory.
...  snip  ...

> Although, the only files I really need out of the
> directory are going to be '.JPG', '.jpg', '.GIF', '.gif', '.JPEG', '.jpeg'.

While this doesn't do exactly what your script does, it will point you in 
the right direction...

<?php

$DirHandle=opendir('.');

while ($FileName = readdir($DirHandle)) {
   switch ( substr($FileName, -4) ) {
      case '.jpg':
      case '.JPG':
      case 'jpeg':
      case 'JPEG':
      case '.gif':
      case '.GIF':
         $FileList[] = $FileName;
         break;
   }
}

# Sort the list alphabetically:
asort($FileList);

echo '<ul>';
while (list(,$Name) = each($FileList) ) {
   echo "<li><a href=\"$Name\">$Name</a></li>\n";
}
echo '</ul>';

?>

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to