Example Get your own PHP Server Open a directory, read its contents, then close:

Started by KingSparta, Dec 09, 2023, 01:58 PM

Previous topic - Next topic

KingSparta

<?php
$dir = "/images/";

// Open a directory, and read its contents
if (is_dir($dir)){
  if ($dh = opendir($dir)){
    while (($file = readdir($dh)) !== false){
      echo "filename:" . $file . "<br>";
    }
    closedir($dh);
  }
}
?>