for some reason if i change $handle in the below script from:
if ($handle = opendir('.')) {
to:
if ($handle = opendir('files')) {
it splurts out this error:
Warning: filesize() [function.filesize]: stat failed for ajaxpagefetcher.js in /home/.philadelphia/homer09001/files.dth-scripts.com/listfiles.php on line 11
Warning: filesize() [function.filesize]: stat failed for Anim8or.exe in /home/.philadelphia/homer09001/files.dth-scripts.com/listfiles.php on line 11
<table border="1"><tr><td>FileName</td><td>File Size</td><td>File Type</td></tr>
<?php
if ($handle = opendir('files')) {
while (false !== ($filename = readdir($handle))) {
if ($filename != "." && $filename != "..") {
if(is_dir($filename) == FALSE)
{
$filesize = filesize($filename);
if ($filesize < pow(2,10)){
$totalsize = "$filesize B";
}
if ($filesize >= pow(2,10) && $filesize < pow(2,20)) {
$totalsize = round($filesize / pow(2,10), 2)." KB";
}
if ($filesize >= pow(2,20) && $filesize < pow(2,30)) {
$totalsize = round($filesize / pow(2,20), 2)." MB";
}
if ($filesize > pow(2,30)) {
$totalsize = round($filesize / pow(2,30), 2)." GB";
}
$path_info = pathinfo($filename);
$ext = $path_info['extension'];
echo "<tr><td>$filename</td><td>$totalsize</td><td>$ext</td></tr>";
}}
}
closedir($handle);
}
?>