How do you get the size of the file?



  • Show me how to put the file in. phpso that the name of the file is marked (e.g.: index.php - 10 kb.functions.php - 25 kb.(a) Could be a function to indicate which one can draw the size of the file.



  • I suggest that:

    function formatFileSize($size) {
        $a = array("B", "KB", "MB", "GB", "TB", "PB");
        $pos = 0;
        while ($size >= 1024) {
            $size /= 1024;
            $pos++;
        }
        return round($size,2)." ".$a[$pos];
    }
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2