/** * Makes out of a byte number a human readable string * * @param int $intBytes * @param bool $bitPhpIni (Value ends with M/K/B) * * @return string */ function bytesToString($intBytes, $bitPhpIni = false) { $strReturn = ""; if ($intBytes >= 0) { $arrFormats = array("B", "KB", "MB", "GB", "TB"); if ($bitPhpIni) { $intBytes = phpSizeToBytes($intBytes); } $intTemp = $intBytes; $intCounter = 0; while ($intTemp > 1024) { $intTemp = $intTemp / 1024; $intCounter++; } $strReturn = number_format($intTemp, 2) . " " . $arrFormats[$intCounter]; return $strReturn; } return $strReturn; }
/** * Returns the max upload size in bytes * * @return int */ public function getPhpMaxUploadSize() { if (phpSizeToBytes($this->getPhpIni("post_max_size")) > phpSizeToBytes($this->getPhpIni("upload_max_filesize"))) { return phpSizeToBytes($this->getPhpIni("upload_max_filesize")); } else { return phpSizeToBytes($this->getPhpIni("post_max_size")); } }