Skip to content
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

Code example on how to use a presigned URL #45

Open
Erikvv opened this issue Oct 25, 2022 · 0 comments
Open

Code example on how to use a presigned URL #45

Erikvv opened this issue Oct 25, 2022 · 0 comments

Comments

@Erikvv
Copy link
Collaborator

Erikvv commented Oct 25, 2022

Background: when making a website with a PHP backend you may not want to pass all traffic to Storj through the PHP backend for cost/performance reasons.

In that case you can use an S3 pre-signed URL to upload or download from the browser to Gateway-MT.

We should have full code examples which demonstrate upload and download like this in https://github.com/storj-thirdparty/uplink-php/tree/main/examples

Roughly it would be

  1. Get (expiring) S3 credentials with
    public function registerAccess(
  2. Use credentials to create presigned url like https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/s3-presigned-url.html
  3. Upload or download via html, redirect or javascript https://stackoverflow.com/questions/39536487/s3-upload-image-with-pre-signed-url-from-browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant