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 Quote 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. Quote Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.