-
The S3 filesystem adapter already supports presigned URLs for downloading files through the The change would be quite simple: diff --git a/src/Illuminate/Filesystem/AwsS3V3Adapter.php b/src/Illuminate/Filesystem/AwsS3V3Adapter.php
index 45d4f54536..1ac6191d45 100644
--- a/src/Illuminate/Filesystem/AwsS3V3Adapter.php
+++ b/src/Illuminate/Filesystem/AwsS3V3Adapter.php
@@ -63,7 +63,8 @@ public function url($path)
*/
public function temporaryUrl($path, $expiration, array $options = [])
{
- $command = $this->client->getCommand('GetObject', array_merge([
+ $commandName = $options['s3Command'] ?? 'GetObject';
+ $command = $this->client->getCommand($commandName, array_merge([
'Bucket' => $this->config['bucket'],
'Key' => $this->prefixer->prefixPath($path),
], $options)); Users can then use the following code to generate a presigned URL for file uploads: $url = Storage::temporaryUrl('file.jpg', now()->addMinutes(5), [
's3Command' => 'PutObject',
]); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Ok, I'm withdrawing my proposal because I realized the following issues with this approach:
So it's probably a bad idea to support this practice. |
Beta Was this translation helpful? Give feedback.
Ok, I'm withdrawing my proposal because I realized the following issues with this approach:
So it's probably a bad idea to support this practice.