Jump to content

list files and shows size


The Sea King

Recommended Posts

I got the code that lists the files:

<?phpif ($handle = opendir('.')) {echo "<ul>";while (false !== ($file = readdir($handle))) {echo "<li><a href='$file'>$file</a> - </li>";}echo "</ul>";closedir($handle);}?>

But I also want it to say it's size. I found this: filesize() but I don't know where to put it. Help?

Link to comment
Share on other sites

put the filesize($file) in the while loopfor example:<?phpif ($handle = opendir('.')) {echo "<ul>";while (false !== ($file = readdir($handle))) {echo "<li><a href='$file'>$file</a> Size: ".filesize($file)." </li>";}echo "</ul>";closedir($handle);}?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...