<?php
function SizeToStr($pFileSize) {
$sfilesize = ($pFileSize > 1073741824) ? (round($pFileSize/1073741824, 2) . "Gb") :
(($pFileSize > 1048576) ? (round($pFileSize/1048576, 2) . "Mb") :
(round($pFileSize/1024, 2) . "Kb"));
return $sfilesize;
}
function ContentSize($pPath) {
$mFSize = 0;
$openpath = opendir($pPath);
while (false != ($mdir = readdir($openpath))) {
if (filetype("$pPath/$mdir") != "dir") {
$mFSize += filesize("$pPath/$mdir");
} else {
if (($mdir != ".") and ($mdir != "..")) {
$mFSize += ContentSize("$pPath/$mdir");
}
}
}
closedir($openpath);
return $mFSize;
}
$currentdir = getcwd();
$limitSize = 204800000;
$usedSize = ContentSize($currentdir);
$freeSize = $limitSize - $usedSize;
print "พื้นที่ทั้งหมด : " . SizeToStr($limitSize) . "</br>";
print "พื้นที่ที่ถูกใช้งาน : " . SizeToStr($usedSize) . "</br>";
print "เหลือพื้นที่อีก : " . SizeToStr($freeSize) . "";
?>
จบ
ปล. $limitSize = 204800000; ค่านี้เปลี่ยน ให้เป็นค่า พื้นที่ ที่เราเช่าไว้ครับ 1M =1024k ครับ คุณ กันเข้าไป