I am getting this error while using the RecursiveDirectoryIterator.
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(public/user_/,public/user_/): The system cannot find the path specified. (code: 3)' in D:\xam\htdocs\s\upload.php:101 Stack trace: #0 D:\xam\htdocs\s\upload.php(101): RecursiveDirectoryIterator->__construct('public/user_/') #1 D:\xam\htdocs\s\upload.php(138): dirSize('public/user_/') #2 {main} thrown in D:\xam\htdocs\s\upload.php on line 101
Here is the code i am using.
function dirSize($directory) {
$size = 0;
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) {
$size+=$file->getSize();
}
return $size;
}
Please help!!!