I\'m trying to POST some data as if I was using FORM on HTML site (ContentType = multipart/form-data). The target is amazon\'s s3. I\'m using HttpWebRequest / HttpWebResponse an
I spent about three days straight trying to solve the same issue. Make absolutely sure you use consistent line endings for your POST body format. I forgot a single carriage return (\r
) in a CRLF sequence and Amazon S3 gave me this error and similar ones.
solved! the boundary was wrong - it is needed to add 2 dashes more for post data than the value in the header has. what was needed to do in above code was:
string boundary = "---------------------------317205771417341028";
request.ContentType = "multipart/form-data; boundary=" + boundary;
[...]
using (Stream s = request.GetRequestStream())
{
boundary = "--" + boundary "\n";
[...] so easy... and yet so annoying...
POST that to your own server not Amazon, and then check the POST - I will bet that your headers are not set correctly, meaning that because you are using multipart form-data, the POST can't be decoded.
You should use the official SDK anyway.
http://aws.amazon.com/sdkfornet/