Problem description
An invalid value is specified for a condition that is specified by the conditions parameter in the policy form field of the PostObject request.
Causes
You initiated a PostObject request to upload an object. However, the content-length-range condition that is specified by the conditions parameter in the policy form field is set to a string. As a result, a JSON parsing error is returned. The content-length-range condition must be set to a positive integer.
Examples
The error is returned because max-len in the content-length-range condition that is specified by the conditions parameter in the policy form field is set to test.
{
"expiration": "2023-02-19T13:19:00.000Z",
"conditions": [
["content-length-range", [1], "test"]
]
}
Solutions
The content-length-range condition specifies the maximum size and minimum size of the object that you can upload. Make sure that the value of the condition is in the following format: ["content-length-range", min-len, max-len]. max-len specifies the maximum size of the object that you can upload in bytes and min-len specifies the minimum size of the object that you can upload in bytes. Make sure that the values of max-len and min-len are positive integers and the value of max-len is greater than or equal to the value of min-len.
{
"expiration": "2023-02-19T13:19:00.000Z",
"conditions": [
["content-length-range", 1, 1024]
]
}
References
For more information about the policy form field, see Appendix: Policy.
For information about how to transfer data from the web client to OSS by using form upload, see Add signatures on the client by using JavaScript and upload data to OSS.
For information about common errors and troubleshooting methods of the PostObject operation, see Errors and troubleshooting methods of PostObject.