Help with Dir List
| From: | melvin nieves | Date: | Fri, 08 Aug 2008 02:00:19 +0000 |
| Subject: | Help with Dir List | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-2354@lists.php.net to get a copy of this message | ||
hello my Name is Melvin im developing a Flex APP with PHP.
i need some help adding &filesize and file ext. filter
this code. thanks in advanced.
<?php
$str = "<root>";
function readfromhere($path=".")
{
global $str;
$currentPath=($path == '.' ? './Shared/' : $path.'/');
//echo "<pre>";
//var_dump($currentPath);
//echo "</pre>";
if ($handle = opendir($currentPath)) {
while (false !== ($file = readdir($handle))) {
//echo "<pre>";
//var_dump($file);
//echo "\n";
//var_dump(is_dir($currentPath.$file));
//echo "</pre>";
if (is_dir($currentPath.$file) && $file != "." && $file !=
"..")
{
$str.='<node type="folder"
name="'.$file.'">';
readfromhere($currentPath.$file);
$str.='</node>';
} else if ($file != "." && $file != "..") {
$str.='<node type="file" name="'.$file.'"
path="'.preg_replace('/\.\/+/i','',$currentPath).$file.'"></node>';
}
}
closedir($handle);
}
return $str;
}
readfromhere();
$str.="</root>";
header('Content-Type: text/xml');
echo $str;
?>