Problem description
The value of the x-oss-forbid-overwrite form field in the PostObject request is invalid.
Causes
You initiated a PostObject request to upload an object. However, the value of the x-oss-forbid-overwrite form field is invalid. As a result, an error is returned.
Examples
The error is returned because the value of the x-oss-forbid-overwrite form field is abc. The value of the x-oss-forbid-overwrite form field must be true or false.
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="key"
big.img
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="x-oss-forbid-overwrite"
abc
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="policy"
eyJleHBpcmF0aW9uIjoiMjAyMy0wMi0xOFQxMzoxOTowMC4wMDBaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjAwMF1dfQ==
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="AWSAccessKeyId"
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="big.img"
Content-Type: application/octet-stream
***
------WebKitFormBoundaryW0DET1iaBMeAOBg3--Solutions
Make sure that the value of the x-oss-forbid-overwrite form field in the request body is valid. The x-oss-forbid-overwrite form field specifies whether the PostObject operation overwrites the existing object that has the same name.
If you do not specify x-oss-forbid-overwrite or if you set x-oss-forbid-overwrite to false, the PostObject operation overwrites the existing object that has the same name.
If you set x-oss-forbid-overwrite to true, the PostObject operation does not overwrite the existing object that has the same name.
References
For more information about the PostObject operation, see PostObject.
For information about how to transfer data from the web client to OSS by using form upload, see Add signatures on the client by using JavaScript and upload data to OSS.
For information about common errors and troubleshooting methods of the PostObject operation, see Errors and troubleshooting methods of PostObject.