How to access file from aws s3 bucket after upload the image to s3 bucket. When i am getting the image it shown access denied error.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>xxxxx</RequestId>
<HostId>xxxxx</HostId>
</Error>
Controller Code is
$sharedConfig = [
'region' => Config::get('filesystems.disks.s3.region'),
'version' => 'latest',
"Effect" => "Allow",
'credentials' => [
'key' => 'xxxx',
'secret' => 'xxxx'
]
];
$sdk = new \Aws\Sdk($sharedConfig);
$s3 = $sdk->createS3();
$res = $s3->putObject([
'Key' => $fileName, // This will overwrite any other files with same name
'SourceFile' => $filePath,
'Bucket' => 'bolttupload'
]);
Storage::copy($res['ObjectURL'],$destinationPath.$fileName);
echo $res['ObjectURL'];die;
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire