note 8347 rejected from function.readdir by sander

From: Date: Sat, 06 Apr 2002 19:11:56 +0000
Subject: note 8347 rejected from function.readdir by sander
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-28744@lists.php.net to get a copy of this message
The same, but with the link with the filename. $directory is the directory were you begin to list file. 'mydir' in http://www.myhost.com/mydir &lt;?php function list_dir($dir) { $handle=opendir($dir); echo "<ul>"; while ($file = readdir($handle)) { if ($file != '.' && $file != '..') print ("<li><a href=\"".$GLOBALS["path"].$file."\">".$file."</a>"); if (is_dir($file) && $file != '.' && $file != '..') { $toto = $GLOBALS["path"]; $GLOBALS["path"] .= $file."/"; chdir ($file); list_dir("."); $GLOBALS["path"] = $toto; chdir (".."); } } echo "</ul>"; closedir($handle); } $directory = "tommz"; $GLOBALS["path"] = "http://".$HTTP_HOST."/".$directory."/"; list_dir("."); ?>

« previous php.notes (#28744) next »