Description
A condition in the Post Policy uses an unsupported matching mode.
Cause
Your PostObject request to upload a file failed because a condition in the conditions array of your Post Policy uses an unsupported matching mode.
Example
In the following Post Policy, the matching mode for the $key condition is ends-with, which is not supported.
{
"expiration": "2023-02-19T13:19:00.000Z",
"conditions": [
["ends-with", "$key", "user/user1"]
]
}Solution
Ensure that each condition in the Post Policy uses a supported matching mode. The conditions array specifies the valid values for the form fields in a POST request. Supported matching modes include content-length-range, eq, starts-with, in, and not-in.
The following is a correct example:
{
"expiration": "2023-02-19T13:19:00.000Z",
"conditions": [
["content-length-range", 1, 1024],
["eq", "$success_action_status", "201"],
["starts-with", "$key", "user/eric/"],
["in", "$content-type", ["image/jpeg", "image/png"]],
["not-in", "$cache-control", ["no-cache"]]
]
}Related documents
For more information about Post Policy, see Appendix: Post Policy.
For an example of a form upload to OSS that uses client-side signing, see JavaScript client-side signing for direct uploads.
For common errors and solutions when calling the PostObject API, see Troubleshooting PostObject errors.