Oct 13, 2022
0
Level 1
How to retrieve a private file from S3 bucket in Flysystem 3.0
Before upgrading to Laravel 9 i did:
$file = File::find(1);
$s3Client = Storage::cloud()->getAdapter()->getClient();
$stream = $s3Client->getObject([
'Bucket' => config('filesystems.disks.s3.bucket'),
'Key' => $file->name
]);
return response($stream['Body'], 200)->withHeaders([
'Content-Type' => $stream['ContentType'],
'Content-Length' => $stream['ContentLength'],
'Content-Disposition' => 'inline; filename="' . $file->original_name . '"'
]);
I'm not sure how to adapt this to the new Flysystem 3.0 format.
Any assistance would be much appreciated.
Please or to participate in this conversation.