I have a bucket called music
in AWS S3 and I have a sub-folder within it called 15
. I can reach this folder on the GUI however using the PHP SDK if I put the folder path of the sub folder 15 as music/15
I get an error. How do I write the path to a sub-folder within the bucket music
?
The code below should help:
private function get_flist() {
try {
$result = $this->s3->getIterator('ListObjects', [
'Bucket' => $this->bucketmp3,
'EncodingType' => 'url'
]);
return $result;
} catch (Aws\Exception\S3Exception $e) {
echo "There was an error getting list of files.
";
print_r($e);
return null; // error
}
}
Note: bucketmp3=music/15