asus Posted January 24, 2007 Posted January 24, 2007 Is there a way to use html or php to parse the content of a directory on a webserver, then setup a link to those files and display them on a page? Thanks Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted January 24, 2007 Posted January 24, 2007 PHP5 has scandir() http://uk.php.net/scandir I dont have 5, so I've used the following in PHP4 function scandir($dir) { $i = 0; $dh = opendir($dir); if (!$dh) { return NULL; } while (false !== ($filename = readdir($dh))) { if ($filename == "." || $filename == "..") continue; $files[$i++] = $filename; } closedir($dh); return $files; } Which I also found on the php site (probably under scandir() comments even) and altered slightly. Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now