0006-00000204
Error 0006-00000204 indicates that the policy form field of a PostObject request fails validation. This topic describes why the validation fails and how to build and encode a valid value for the field.
Problem description
The value of the policy form field in the PostObject request is not a valid JSON structure.
Causes
OSS decodes the value of the policy form field in Base64 and then validates the decoded value as JSON. If the decoded value is not a valid JSON structure, the PostObject request fails.
Solutions
Generate the value of the policy form field in the following order:
Write the value as a valid JSON structure. For more information about the
policyform field, see Appendix: Policy.Encode the JSON structure in UTF-8.
Encode the UTF-8 encoded value in Base64, and use the result as the value of the
policyform field.
The following example shows a valid policy structure. Replace the example values, including the expiration value, with the values that apply to your request.
{
"expiration": "2014-12-01T12:00:00.000Z",
"conditions": [
{"bucket": "johnsmith"},
["content-length-range", 1, 10],
["eq", "$success_action_status", "201"],
["starts-with", "$key", "user/eric/"],
["in", "$content-type", ["image/jpeg", "image/png"]],
["not-in", "$cache-control", ["no-cache"]]
]
}If the conditions list in the request contains the content-length-range condition, the minimum and the maximum allowed sizes of the object that you want to upload must both be positive integers, as in ["content-length-range", 1, 10].
References
For an example of how to upload data to OSS from a web client 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 when you call the PostObject operation, see Errors and troubleshooting methods of PostObject.