oss上传:One or more of the specified parts could not be found or the specified entity tag might not have matched the part’s entity tag
使用OSS Browser浏览器上传文件,提示:
One or more of the specified parts could not be found or the specified entity tag might not have matched the part's entity tag
通过调试浏览器调试提示
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>InvalidPart</Code>
<Message>One or more of the specified parts could not be found or the specified entity tag might not have matched the part's entity tag.</Message>
<RequestId>5EF05589FBD3EC32334477C6</RequestId>
<HostId>xxxx.oss-cn-hangzhou.aliyuncs.com</HostId>
<ETag>undefined</ETag>
<PartNumber>1</PartNumber>
<UploadId>F045F0886BA142A69671908EEF706C30</UploadId>
</Error>
解决办法很简单有效,是因为这种方式需要跨越,并且需要将特定字段Etag在header中展示出来。阿里云设置跨越如下。
找到指定oss bucket,权限管理>跨域设置>设置>创建规则或者编辑
- 来源:*
- 允许Methods:全部勾选,PUT, GET, POST, DELETE, HEAD
- 允许Headers:*
- 暴露Headers:Etag
设置好刷新浏览器,上传成功。