Calculate file size ::Class::

Information for PHP. Hypertext Preprocessor
Post Reply
dzcadii
Posts: 94
Joined: Sun Mar 01, 2015 4:36 am

Calculate file size ::Class::

Post by dzcadii » Sun Mar 01, 2015 6:33 pm

Outputs 12B or 20MB

Code: Select all

<?
/**********************************
    files.class.php
**********************************/
class Files{
var $Errors=array();
function Files(){
}
function StaticFSize($IVal){	
$TFileS=$IVal;
$Type=array("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
$Index=0;
while($TFileS>=1024){
$TFileS/=1024;
$Index++;
}
$TFS=round($TFileS,2);
$this->FDS=$TFS . $Type[$Index];//is the output			
}
}
?>

Post Reply