خرید بک لینک

Vote count: 0

i want to calculate the storage of a folder with all the subfolders included.I know i have to do womething with Recursive DirectoryIterator, but he does not count all the storage in folder with subfolders together:

This is my root directory:

$MainDir = 'uploads/sfm/'.$UserID;

This is how i try to count the size of all files together, included the files in the subfolders:

/* Calculate used storage */
if (is_dir($MainDir)) { 
$SumStorage = 0;
foreach (new RecursiveDirectoryIterator($MainDir) as $file) {
if ($file->isFile()) {
    $SumStorage += $file->getSize();
}
}

$UsedStorage = $SumStorage/$LimitStorage*100;    
}

But it does not count the total size of all the files

what is going wrong?

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 14 ارديبهشت 1395 ساعت: 21:50

صفحه بندی