I have an s3 bucket that I am using for file storage with my PHP/Laravel application.
I have a certain case where I need to manually add a bunch of pdf's to a bucket in a given folder/prefix. I then need to run a csv import into my db. Part of the import is the pdf filenames.
For each iteration thought the csv import I want to use the known filename and go link the imported item to the pdf in S3.
I have been messing with this and have the AWS S3 SDK installed but I don't see a way of getting the object back from S3 based on a filename.
I am running: php 7.2 aws sdk v3.9 via composer
What I am currently testing is:
$results = $s3->getPaginator('ListObjects', [
'Bucket' => env('S3BUCKET'),
'Prefix' => 'folder-name/'
]);
foreach ($results as $result) {
foreach ($result['Contents'] as $object) {
$doc = $s3->getObject([
'Bucket' => env('S3BUCKET'),
'Key' => $object['Key']
]);
dd($doc);
The issue here is that no filename is listed so I can't run a compare of any kind.
TIA
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire