i am coding a simple doc managing script and need to get the file size and file type /file or folder/ in a table. somehow it doesn't work into the mention directory. please help if possible:
<?php
$path = "./documents";
$dh = dir($path);
while( ($file=$dh->read()) )
{
if( $file=="." || $file=="..")continue;
echo "<tr><td><a href='download.php?f=$file' title='Click to Open/Download'>$file</a></td>";
echo "<td>";
echo (is_file($file))? "<img src='file.jpg'/> FILE" : "<img src='folder.jpg'/> FOLDER ";
echo "</td><td>" .filesize($file)."</td>";
echo "<td><input type='checkbox' name='delete[]'/></td></tr>";
}
?>
it does actually has 2 errors - one the file size doesn't work for the location, if i change it to path to "." - everything is ok, but if i try to change to the folder where i need it /documents ...all goes bad, and secondly - it doesn't take the right icon file as well, same type of problem. thank you
$path = "../documents";
– Aube