0006-00000219

更新时间:
复制 MD 格式

Problem description

A PostObject request fails because the content-length-range condition in the policy form field has an invalid value.

Causes

The content-length-range condition specifies the allowed size range for uploaded objects. Its format is:

["content-length-range", min-len, max-len]

max-len must be greater than or equal to min-len. If max-len is less than min-len, the request fails.

Examples

The following policy sets max-len to 10 and min-len to 20. Because max-len (10) is less than min-len (20), the request fails.

{
    "expiration": "2023-02-19T13:19:00.000Z",
    "conditions": [
        ["content-length-range", 20, 10]
    ]
}

Solutions

Set max-len to a value greater than or equal to min-len.

Example
Invalid["content-length-range", 20, 10]max-len (10) is less than min-len (20)
Valid["content-length-range", 1, 1024] — allows objects from 1 to 1,024 bytes

The following example shows a valid policy:

{
    "expiration": "2023-02-19T13:19:00.000Z",
    "conditions": [
        ["content-length-range", 1, 1024]
    ]
}

References