Using ASIHTTPRequest to Upload File to S3 with Content-MD5 Header

I've had success using ASI to upload files to S3. However, I am having problems uploading to work when setting the "Content-MD5" header value with the MD5 hash of the file I'm uploading. I am using the ASIS3ObjectRequest: addRequestHeader post to set the header value. The error I returned with is 403 with the message:

Request error: Error Domain = ASIHTTPRequestErrorDomain Code = 2 "The request signature we signed does not match the signature you provided. Please check your key and signature method." UserInfo = 0x5ec210 {NSLocalizedDescription = Our signed request signature does not match the signature you provided. Check your key and signing method.}

Honestly, I checked the hash value of the file by uploading the file successfully without the Content-MD5 header, and then I checked the ETag for the file, and the hash I was trying to use for the upload matches the ETag value! Any ideas?

Thanks in advance for any answer.


source to share

All Articles