Uploading a file to a S3 Presigned URL

后端 未结 2 1377
-上瘾入骨i
-上瘾入骨i 2021-01-17 01:29

I\'m trying to upload a local file to a S3 presigned URL. It should be really straight forward, but looks like I\'m missing something.

http://docs.aws.amazon.com/Ama

相关标签:
2条回答
  • 2021-01-17 01:45

    You can't simply PUT a file on S3. Use the write API to do that:

    s3_object.write(:file => "local-file.zip")
    
    0 讨论(0)
  • 2021-01-17 02:00

    What about using PresignedPost

    form = bucket.presigned_post(:key => "photos/${filename}")
    form.url.to_s        # => "https://mybucket.s3.amazonaws.com/"
    form.fields          # => { "AWSAccessKeyId" => "...", ... }
    form.url             # your signed url
    
    0 讨论(0)
提交回复
热议问题