Problem description
The value of the content-length-range condition in the policy form field in a PostObject request is invalid.
Causes
You initiate a PostObject request to upload an object. However, the value that you specify for the content-length-range condition in conditions in the policy form field is invalid. As a result, a request error is reported. The content-length-range condition specifies the maximum and minimum sizes of the object that you want to upload. The value of this condition must be in the following format: ["content-length-range", min-len, max-len]. max-len specifies the maximum size of the object and min-len specifies the minimum size of the object. The value of max-len must be greater than or equal to the value of min-len. Otherwise, a request error occurs.
Examples
The following code provides an example of the content-length-range condition in the conditions field. In this example, max-len is set to 10 and min-len is set to 20. The value of max-len is less than the value of min-len.
{
"expiration": "2023-02-19T13:19:00.000Z",
"conditions": [
["content-length-range", 20, 10]
]
}
Solutions
Make sure that 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 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.