note 101227 rejected from function.filesize by danbrown
| From: | danbrown@php.net | Date: | Fri, 03 Dec 2010 18:04:20 +0000 |
| Subject: | note 101227 rejected from function.filesize by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174592@lists.php.net to get a copy of this message | ||
Note Submitter: pp2006gr at yahoo dot gr
----
Hi,
I have this php to list the files into a directory. I want also to add their size, can you fill or
make the script, thanks.
function file_list($dir)
{
global $d;
$dl = array();
if ($hd = opendir($dir))
{
while ($sz = readdir($hd))
{
if ((preg_match("/^\./",$sz)==0) && !is_dir($dir.$sz))
$dl[] = $sz;
}
closedir($hd);
}
asort($dl);
echo '<h3>Files:</h3><div id="links"><ul>';
foreach ($dl as $link)
{
echo '<li><a
href="'.$d.$link.'">'.$link.'</a></li>';
}
echo '</ul></div>';
}
$dir = "./".$d;
file_list($dir);
unset ($dir);
unset ($dl);