1

Using curl, if I do:

curl -v --upload-file tumblr_nl29hydgtP1uq22wlo1_r2_1280.jpg https://s3.amazonaws.com/mybutcket/1_myfile\?AWSAccessKeyId\=mykey\&Expires\=1427991209\&Signature\=DzspMuzu5%2Fpo43PWriJdOZnF2FA%3D

It uploads just fine. However, when I try to upload in the browser, I get this error

<?xml version="1.0" encoding="UTF-8"?>
<Error>
   <Code>SignatureDoesNotMatch</Code>
   <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
   <AWSAccessKeyId>mykey</AWSAccessKeyId>
   <StringToSign>PUT

multipart/form-data
1427992617
/mybucket/1_myfile</StringToSign>
   <SignatureProvided>dEyHSGBGcSmCfsZ1ahPryYTaB0U=</SignatureProvided>
   <StringToSignBytes>50 55 54 0a 0a 6d 75 6c 74 69 70 61 72 74 2f 66 6f 72 6d 2d 64 61 74 61 0a 31 34 32 37 39 39 32 36 31 37 0a 2f 6d 6f 6e 65 67 72 61 70 68 2e 64 65 76 2e 75 70 6c 6f 61 64 73 2f 31 5f 6d 79 66 69 6c 65</StringToSignBytes>
   <RequestId>F2C56B03E9F27E3F</RequestId>
   <HostId>4sC6jReptppcxmE5yb5MvcZ70cB/gC0obCMEZHI+2zC/qqNFtxHd2wU2+niCHBHV</HostId>
</Error>

My Request Headers are attached enter image description here

1
  • Did you compare the string to sign, from the error response, with the string you actually signed? multipart/form-data doesn't make a lot of sense, here. Commented Apr 2, 2015 at 22:03

1 Answer 1

3
+50

Your curl command line uses --upload-file, which makes a HTTP PUT request.

Your browser "upload" is most likely not using PUT - based on the response you show you tried a multi-part formpost.

I would guess that the difference between these two is big enough to warrant the server to act and respond very differently. It isn't only the request method that is different but a multi-part formpost will also format the data in a way that the plain PUT doesn't.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.