上传文件到OSS报错:[Server]Unable to execute HTTP request: Position is not equal to file length

- 日理万妓 2021-09-25 05:02 870阅读 0赞

上传文件到OSS报错:

[Server]Unable to execute HTTP request: Position is not equal to file length

控制台报类似以下的错:

  1. [ErrorCode]: PositionNotEqualToLength
  2. [RequestId]: 603D07EA9ACC07383080C699
  3. [HostId]: naiyi-course.oss-cn-shenzhen.aliyuncs.com
  4. [ResponseError]:
  5. <?xml version="1.0" encoding="UTF-8"?>
  6. <Error>
  7. <Code>PositionNotEqualToLength</Code>
  8. <Message>Position is not equal to file length</Message>
  9. <RequestId>603D07EA9ACC07383080C699</RequestId>
  10. <HostId>xxx-xxxx.oss-cn-shenzhen.aliyuncs.com</HostId>
  11. </Error>
  12. 27:40.004 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet]:175 Servlet.service() for servlet [dispatcherServlet] in context with path [/file] threw exception [Request processing failed; nested exception is com.aliyun.oss.OSSException: Position is not equal to file length

说明

其实报错很明显,我的代码未加判断,分片上传文件功能代码不够严谨。

解决

将OSS上的文件,先删掉,再重新执行即可。

发表评论

表情:
评论列表 (有 0 条评论,870人围观)

还没有评论,来说两句吧...

相关阅读