问题描述
PostObject请求中file表单域之前的数据大小超出限制。
问题原因
您发起了PostObject请求上传文件,但是请求体中file之前的表单域value总大小超过8 MB,导致请求报错。
问题示例
以下请求中前五个表单域的value大小共计10 MB。
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="filed1"
xxx...(此处省略2MB个字符)...xxx
Content-Disposition: form-data; name="filed2"
xxx...(此处省略2MB个字符)...xxx
Content-Disposition: form-data; name="filed3"
xxx...(此处省略2MB个字符)...xxx
Content-Disposition: form-data; name="filed4"
xxx...(此处省略2MB个字符)...xxx
Content-Disposition: form-data; name="filed5"
xxx...(此处省略2MB个字符)...xxx
Content-Disposition: form-data; name="name"
big.img
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="key"
${filename}
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="policy"
eyJleHBpcmF0aW9uIjoiMjAyMy0wMi0xOFQxMzoxOTowMC4wMDBaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjAwMF1dfQ==
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="OSSAccessKeyId"
LTAI5tMw****
------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="big1.img"
Content-Type: application/octet-stream
解决方案
确保PostObject请求的请求体中file之前的表单域value总大小超过8 MB。
相关文档
关于PostObject接口的更多信息,请参见PostObject。
关于Web端表单直传OSS的示例,请参见JavaScript客户端签名直传。
关于调用PostObject接口的常见错误及解决方法,请参见Post Object错误及排查。
文档内容是否对您有帮助?