0006-00000204

更新时间:
复制 MD 格式

Problem description

The policy form field in a PostObject request does not contain a valid JSON structure.

Cause

OSS first decodes the value of the policy form field from Base64. The request fails if the decoded value is not a valid JSON structure.

Example

None

Solutions

  • Ensure the policy form field value is a valid JSON structure before encoding. To generate the final value, first UTF-8 encode the JSON string, and then Base64 encode the result.

    {
      "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 content-length-range parameter is included in the Conditions list of a request, both the minimum and maximum allowed sizes of the uploaded Object must be positive integers. For example, ["content-length-range", 1, 10].

References