简体   繁体   中英

How can I send a file using AWS S3 API conding in java? My error is: The Content-MD5 you specified is not valid

I can send files without problem using Postman but when try send it in java it doesn't work.

I've tried everything, but always when try send a file with Content I receive this Error Message: The Content-MD5 you specified is not valid.

When I said, "with Content" I mean for example a text file named "text.txt" with "test 123". But when I tried send the same file but without content it's works fine. enter image description here Error messagem: {"Error": { "Message": "The Content-MD5 you specified is not valid.", "RequestId": 822352709, "Resource": "/dns1niadf001/textoSemConteudo.txt", "Code": "InvalidDigest" }}

I had the same problem with the .NET AWSSDK.S3. The key was that when using PutObjectRequest object, there is a default value in the property UseChunkEncoding=true. Well, if you set that value to false everything will work fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM