diff --git a/README.md b/README.md index 83f0099..a8f3b3e 100644 --- a/README.md +++ b/README.md @@ -273,6 +273,8 @@ Get directory size ```php +$dir = "profiles/admin/images"; + $bunny->dirSize($dir); ``` diff --git a/src/BunnyAPIStorage.php b/src/BunnyAPIStorage.php index 4808193..74f50d6 100644 --- a/src/BunnyAPIStorage.php +++ b/src/BunnyAPIStorage.php @@ -138,7 +138,7 @@ public function getFileSize(string $file): int public function dirSize(string $dir = ''): array { - $array = json_decode(file_get_contents(self::STORAGE_API_URL . "/$this->storage_name" . $dir . "/?AccessKey=" . $this->access_key), true); + $array = json_decode(file_get_contents(self::STORAGE_API_URL . "/$this->storage_name/" . $dir . "/?AccessKey=" . $this->access_key), true); $size = $files = 0; foreach ($array as $value) { if ($value['IsDirectory'] === false) {