Problem description
A field type specified in conditions in the policy form field of a PostObject request is invalid.
Causes
You initiate a PostObject request to upload an object. However, a field type that is specified in conditions in the policy form field of the request body is invalid. As a result, a request error occurs.
Examples
The following sample code provides an example of the filters in the conditions field. In this example, ["not-in", "cache-control", "no-cache"] is specified. The "not-in" filter requires that the "no-cache" filter must be of the List type. However, the "no-cache"
filter is of the String type. As a result, a request error occurs.
{
"expiration": "2023-02-19T13:19:00.000Z",
"conditions": [
["not-in", "cache-control", "no-cache"]
]
}
Solutions
Make sure that filters in the conditions field are of valid data types. The following sample code provides an example of the filters in the conditions field:
{
"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/jpg", "image/png"]],
["not-in", "$cache-control", ["no-cache"]]
]
}
References
For more information about the policy form field, see the "Appendix: Policy" section of the PostObject topic.
For more information about how to transfer data from a web client to Object Storage Service (OSS) by using form upload, see Add signatures on the client by using JavaScript and upload data to OSS.
For more information about common errors and troubleshooting methods of the PostObject operation, see PostObject.