return byte's'

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9857 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2011-11-22 09:59:51 +00:00
parent 634b2c4e6c
commit 99e196cd48

View file

@ -321,8 +321,9 @@ class FileHandler {
* @return file size string
**/
function filesize($size) {
if(!$size) return "0Byte";
if($size < 1024) return ($size."Byte");
if(!$size) return '0Byte';
if($size === 1) return '1Byte';
if($size < 1024) return $size.'Bytes';
if($size >= 1024 && $size < 1024*1024) return sprintf("%0.1fKB",$size / 1024);
return sprintf("%0.2fMB",$size / (1024*1024));
}
@ -426,6 +427,7 @@ class FileHandler {
if($last == 'g') $val *= 1024*1024*1024;
else if($last == 'm') $val *= 1024*1024;
else if($last == 'k') $val *= 1024;
else $val *= 1;
return $val;
}