Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Size($path)
- {
- $bytes = sprintf('%u', filesize($path));
- if ($bytes > 0)
- {
- $unit = intval(log($bytes, 1024));
- $units = array('B', 'KB', 'MB', 'GB');
- if (array_key_exists($unit, $units) === true)
- {
- return sprintf('%d %s', $bytes / pow(1024, $unit), $units[$unit]);
- }
- }
- return $bytes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement