All Products
Search
Document Center

Object Storage Service:0006-00000004

Last Updated:Apr 30, 2025

Problem description

When you call the PostObject operation to upload an object, the object size does not meet the requirements.

Causes

You initiate a PostObject request to upload an object. However, an invalid value is specified for the content-length-range condition in the policy form field.

Examples

The following code provides an example. In this example, small.img is the object to be uploaded.

POST / HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Content-Length: 6443500495
Date: Sat, 18 Feb 2023 05:17:02 GMT
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryW0DET1iaBMeAOBg3
Host: example-bucket.oss-cn-hangzhou.aliyuncs.com
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="name"
small.img
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="key"
${filename}
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="policy"
eyJleHBpcmF0aW9uIjoiMjAyMy0wMi0xOFQxMzoxOTowMC4wMDBaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDEwMDg1NzYwMDAsMTA0ODU3NjAwMF1dfQ==
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="OSSAccessKeyId"
LTAI****************
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="success_action_status"
200
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="signature"
miAoLVohS5*****WEXyC3wVecaQ=
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="file"; filename="small.img"
Content-Type: application/octet-stream
***
------WebKitFormBoundaryW0DET1iaBMeAOBg3--

The following code shows the value of the policy before encoding:

{
  	"expiration": "2023-02-18T13:19:00.000Z", // Configure the expiration time of the policy. If the validity period is exceeded, you cannot use the policy to upload objects.
    "conditions": [
    ["content-length-range",  1008576000, 1048576000] // Specify the size limit for the uploaded object. 
    ]
}

In the preceding example, the size of the small.img object to be uploaded does not meet the size limit of 1008576000 bytes specified by the content-length-range condition.

Solutions

Make sure the size of the object that you want to upload meets the size limit specified by the content-length-range condition in the policy form field.

References