2回答
- 新しい順
- 投票が多い順
- コメントが多い順
0
OK so I just realized that I needed to include the Content-Type header with the request.
fetch(action, {
method: "POST",
headers: {
"Content-Type": "...."
},
body: form
})
But when I set my Content-Type to "multipart/form-data", I'm getting this error:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>MalformedPOSTRequest</Code>
<Message>The body of your POST request is not well-formed multipart/form-data.</Message>
<RequestId>7F543E78F106B3A4</RequestId>
<HostId>YV+rDi49ovxQJhZ9cGAWAxWwHz4g8xBS55gaD/tPN4EgAvrkAnMSbXiXL5m3g9xi+BvE8Rj76fw=</HostId>
</Error
>```
And when I set it to undefined, null or false like what I've read from many sources, I get this:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>PreconditionFailed</Code>
<Message>At least one of the pre-conditions you specified did not hold</Message><Condition>Bucket POST must be of the enclosure-type multipart/form-data</Condition>
<RequestId>E2993D140D291888</RequestId>
<HostId>+HZFLQbfjAWBQ7SY8FXWh4hUarRr2YefjOENWH/Eh7XZzuxyfa5DMy1didMZWhPA14XW3ql47iQ=</HostId>
</Error
>```
Also if I did not specify the Content-Type, I will go back to receiving Invalid JSON error like before
EDIT: Actually, not setting Content-Type leaves my browser to set the correct Content-Type and its boundary. But I'm still getting Invalid JSON error...
回答済み 6年前
0
Ok, sorry. Silly me.
Conditions: [
{ "bucket": "bucket" },
["eq", "$key", 'file'] (<-------- MISSING COMMA)
["content-length-range", 1, 1024 * 1024 * 15],
{"success_action_status": "200"}
]
Problem solved.
Edited by: ionizer on Nov 14, 2017 1:30 AM
回答済み 6年前
関連するコンテンツ
- AWS公式更新しました 1年前
- AWS公式更新しました 1年前