1
My project is:
List my Buckets
List the objects of each Bucket
I created a foreach to list the Buckets and it worked perfectly.
The same thing didn’t happen with the foreach of the objects.
$buckets = $s3->getIterator('ListBuckets', []);
foreach($buckets as $bucket) {
$objects = $s3->getIterator('ListObjects', [ 'Bucket' => $bucket ]);
foreach($objects as $object) {
// não retornou nada e ainda deu erro
}
}
Error in page displays:
Fatal error: Uncaught InvalidArgumentException: Found 1 error while validating the input provided for the ListObjects operation: [Bucket] must be a string or an object that implements __toString(). Found array(2) in C:\xampp\htdocs\backup\vendor\aws\aws-sdk-php\src\Api\Validator.php:65 Stack trace: #0 C:\xampp\htdocs\backup\vendor\aws\aws-sdk-php\src\Middleware.php(79): Aws\Api\Validator->validate('ListObjects', Object(Aws\Api\StructureShape), Array) #1 C:\xampp\htdocs\backup\vendor\aws\aws-sdk-php\src\S3\S3Client.php(405): Aws\Middleware::Aws\{closure}(Object(Aws\Command), NULL) #2 C:\xampp\htdocs\backup\vendor\aws\aws-sdk-php\src\S3\S3Client.php(428): Aws\S3\S3Client::Aws\S3\{closure}(Object(Aws\Command), NULL) #3 C:\xampp\htdocs\backup\vendor\aws\aws-sdk-php\src\S3\S3Client.php(362): Aws\S3\S3Client::Aws\S3\{closure}(Object(Aws\Command), NULL) #4 C:\xampp\htdocs\backup\vendor\aws\aws-sdk-php\src\S3\S3Client.php(381): Aws\S3\S3Client::Aws\S3\{closure}(Object(Aws\Command), NULL) #5 C:\xampp\htdocs\backup\vendor\aws\aws-s in C:\xampp\htdocs\backup\vendor\aws\aws-sdk-php\src\Api\Validator.php on line 65
Would anyone know how to make this listing of objects inside the Buckets work?
Any help is welcome!
Welcome to Stackoverflow in Portuguese. The official language used here is Portuguese, can you translate your question? If you prefer, you can ask the same question on Stackoverflow.com.
– Jéf Bueno