-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[9.x] Add S3 temporaryUploadUrl
method to AwsS3V3Adapter
#45753
Conversation
temporaryUploadUrl
method to AwsS3V3AdaptertemporaryUploadUrl
method to AwsS3V3Adapter
This is going to be a huge lifesaver. |
// have full control over the base path for this filesystem's generated URLs. | ||
if (isset($this->config['temporary_url'])) { | ||
$uri = $this->replaceBaseUrl($uri, $this->config['temporary_url']); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this block of code actually needed for temporary upload URLs? Why or why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we all know, temporary_url
option of disks
config in config/filesystems.php
file is used to override the host/base url of the generated temporary URLs.
temporaryUrl()
already included this logic of replaceBaseUrl()
, So I included it too in my proposed temporaryUploadUrl()
method.
As you can see, temporaryUploadUrl()
generated a URL with my custom host i.e. 'example.com' since I set it up in the temporary_url config.
Pr for doc: laravel/docs#8480 |
I'm not sure this is totally complete. Depending on the options you pass, you may also need to get the required headers that should be included in the upload request (via the |
Well I'm not sure about how vapor temporary upload urls work. But using this I was able to upload files from files uploaders like Uppy or dropzone etc. that can directly upload to s3. Meaning no file request comes to my server. |
Can you clarify the required headers you are talking about. I can complete this pr code if required |
Sure - you can see the controller we use to request signed upload URLs here: https://github.com/laravel/vapor-core/blob/2.0/src/Http/Controllers/SignedStorageUrlController.php |
Thanks, I'll look into it and complete the pr asap 😄 |
@taylorotwell sorry for the delay. But I recently unfortunately caught a fever. For the mean time you can draft this PR. Once I get better. I'll complete it 😊. Just wanted to let you know. |
@aneeskhan47 get well soon! |
@taylorotwell I have added the bool |
I think headers can always be included and this method can return array always. |
You are correct about this. but lets see what taylor thinks. |
@taylorotwell since Laravel v10 is coming in feb. how about this should be on 10.x branch instead of v9.x? |
it's been a long day without my friend and I'll tell you about it when I see you again 👀. |
Hi,
This method
temporaryUploadUrl
is helpful for getting presign upload URL from S3 for upload. useful for js uploaders e.gfilepond
etc. so they can upload to this URL directly.we just have to replace the
GetObject
command withPutObject
.Usage: