0006-00000212

更新时间:
复制 MD 格式

Problem description

The expiration value in the PostObject policy is not a valid ISO 8601 datetime string.

Causes

OSS validates the expiration field when processing a PostObject request. The value must be an ISO 8601 datetime string in GMT, using the T separator between date and time and the Z suffix to indicate UTC. A plain datetime string without these elements fails validation.

Examples

The following policy triggers the error because expiration uses a space instead of T as the date-time separator, and omits the Z suffix:

{
    "expiration": "2023-02-19 13:19:00",
    "conditions": [
        ["content-length-range", 0, 1048576000]
    ]
}

Solutions

Set expiration to a valid ISO 8601 datetime string in the format YYYY-MM-DDTHH:mm:ss.sssZ:

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

The following table shows the differences between the invalid and valid formats:

ElementInvalidValidDescription
Date-time separatorspaceTISO 8601 requires T between date and time
Timezone(absent)ZZ denotes UTC (equivalent to GMT+0)
Milliseconds(absent).000Optional but recommended for clarity
The expiration field specifies when the policy expires, not when the uploaded object expires. Set it to a future time relative to when your client generates the policy.

References