The script works fine until I have it search the directory data, it returns the file names, but it doesnt return the filesize. Any hints?
Here is what I have already.
Code: Select all
theDirectory = "data";
$listDirectories = false;
if(is_dir($theDirectory))
{
echo "<table><tr><td>Name</td><td>Type</td><td>Size</td></tr>";
$dir = opendir($theDirectory);
while(false !== ($file = readdir($dir)))
{
$type = filetype($theDirectory ."/". $file);
if($listDirectories || $type != "dir")
{
echo "<tr><td>" . $file . "</td>";
echo "<td>" . $type . "</td>";
echo "<td>";
if($type == "file")
echo filesize($file);
echo "</td></tr>";
}
}
closedir($dir);
echo "</table>";
}
else
{
echo $theDirectory . " is not a directory";
}Thanks!