Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6538171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:42:16+00:00 2026-05-25T10:42:16+00:00

I am reading the documentation of passing a querystring to Amazon’s S3 for authentication,

  • 0

I am reading the documentation of passing a querystring to Amazon’s S3 for authentication, and can’t seem to grok how exactly the StringToSign is created and used. I am looking for a concrete example to illustrate (1) how to construct the StringToSign, and (2) once I have the signature, how to call the form.

For example’s sake, let’s say the following is my information:

Content-type='image/jpeg'
Bucket='test-bucket'
Key = 'filename'
ACL = 'public-read'
Expiration = '(never expires)'
Access Key = '12345'
Secret Password = '1a2b3c'
File = <file the user uploads>

How would I get the StringToSign value from this? And once I have that, how would I create the following form:

<form action="??" method="post" enctype='multipart/form-data' class="upload-form">
    <input name="file" type="file"> 
</form>

And for reference: http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html#RESTAuthenticationQueryStringAuth. Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:42:17+00:00Added an answer on May 25, 2026 at 10:42 am

    Based on what you described, it seems like you want to support browser-based uploads using POST. There is a section of the AWS documentation which talks about this.

    As an overview keep in mind you’ll either have to make your bucket publically writeable or include a policy document. I’ll assume you’ll be including a policy document (check the docs if you don’t want to):

    A policy document is just a fragment of JSON that is used to authenticate the request, and gives a bunch of conditions that must be met before data is uploaded. E.g:

    "expiration": "2020-12-01T12:00:00.000Z",
    "conditions": [
        {"acl": "public-read" },
        {"bucket": "test-bucket" },
        ["eq", "$key", "filename"],
      ]
    }
    

    This says the action to upload will be allowed until 2020, given that the bucket is only publically readable, the bucket name is ‘test-bucket’ and the key is exactly equal to ‘filename’.

    Now, to construct your signature you take the above JSON doc, UTF-8 encode it and then base64 that and then sign the whole thing using your secret access key (using hmac sha1) and finally base64 that whole thing

    policy_data = ... # stuff above
    enc_policy = base64.b64_encode(policy_data.encode('utf8'))
    signed = base64.b64_encode(hmac.new(AWS_SECRET, enc_policy, hashlib.sha1))
    

    Then finally, your form would look something like this:

     <form action="http://test-bucket.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
        Key to upload: <input type="input" name="key" value="filename" /><br />
        <input type="hidden" name="acl" value="public-read" />
        <input type="hidden" name="success_action_redirect" value="http://test-bucket.s3.amazonaws.com/successful_upload.html" />
        Content-Type: <input type="input" name="Content-Type" value="image/jpeg" /><br />
        <input type="hidden" name="AWSAccessKeyId" value="YOUR_ACCESS_KEY_ID" />
        <input type="hidden" name="Policy" value="<enc_policy from above>" />
        <input type="hidden" name="Signature" value="<signed from above>" />
        File: <input type="file" name="file" /> <br />
        <!-- The elements after this will be ignored -->
        <input type="submit" name="submit" value="Upload to Amazon S3" />
      </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Java, and while reading documentation so far I can't find any
reading the documentation for java org.w3c.dom.ls it seems as a Element only can be
I'm reading the jQuery load documentation and it mentions that I can use load
Reading through documentation, I found following: 1.9.1 1.8.4 1.8.2 A version of 1.8.2 select
Reading the documentation it seems this might not be possible, but it seems that
When reading some documentation about assertions, I found: java -ea -dsa Enables assertions in
I know from reading Microsoft documentation that the "primary" use of the IDisposable interface
I am using reading the documentation for app domains in .net 3.5 and came
I'm struggling to implement ACL in CakePHP. After reading the documentation in the cake
Reading Kohana's documentation, I found out that the main difference in 3.0 version is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.