0006-00000217

更新时间:
复制 MD 格式

Description

A condition in the Post Policy uses an unsupported matching mode.

Cause

Your PostObject request to upload a file failed because a condition in the conditions array of your Post Policy uses an unsupported matching mode.

Example

In the following Post Policy, the matching mode for the $key condition is ends-with, which is not supported.

{
    "expiration": "2023-02-19T13:19:00.000Z",
    "conditions": [
      	["ends-with", "$key", "user/user1"]
    ]
}

Solution

Ensure that each condition in the Post Policy uses a supported matching mode. The conditions array specifies the valid values for the form fields in a POST request. Supported matching modes include content-length-range, eq, starts-with, in, and not-in.

The following is a correct example:

{
    "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/jpeg", "image/png"]],
        ["not-in", "$cache-control", ["no-cache"]]
    ]
}

Related documents