开发者社区> 问答> 正文

PHPOSSSDK上传文件失败

我按照SDK文档简单测试上传:
$res = $oss->upload_file_by_file($bk,"aaa.pdf","vclua-0.5-qrf.pdf");
echo $res->body;

那个pdf文件已提前上传到脚本同一目录下。返回结果为:

ERROR
The requested URL could not be retrieved

Invalid Request error was encountered while trying to process the request:

    PUT /sw99/aaa.pdf HTTP/1.1
    Proxy-Authorization: Basic YWNlOmFjZTEyM3F3ZQ==
    User-Agent: RequestCore/1.4.3
    Accept: */*
    Accept-Encoding: deflate, gzip
    Referer: htt p : / / oss.aliyuncs.com/sw99/aaa.pdf
    Proxy-Connection: Keep-Alive
    Content-Type: application/pdf
    Date: Tue, 05 May 2015 04:17:40 GMT
    Host: oss.aliyuncs.com
    Authorization: OSS xxxxx:xxxxxxx(已马赛克)
    Content-Length: 270179
    Expect: 100-continue

Some possible problems are:

    Missing or unknown request method.

    Missing URL.

    Missing HTTP Identifier (HTTP/1.0).

    Request is too large.

    Content-Length missing for POST or PUT requests.

    Illegal character in hostname; underscores are not allowed.

    HTTP/1.1 "Expect:" feature is being asked from an HTTP/1.0 software.

Your cache administrator is root.

Generated Tue, 05 May 2015 04:17:40 GMT by localhost (squid/3.1.10)

HTTP status 为 417。
无论是 upload_file_by_file,还是upload_part,都返回同样的错误。请问这究竟是什么原因?

展开
收起
top398 2015-05-05 13:15:16 8908 0
2 条回答
写回答
取消 提交回答
  • 将整个请求抓个包看看,从response来看
    Generated Tue, 05 May 2015 04:17:40 GMT by localhost (squid/3.1.10)
    根本不是OSS回复的请求啊。
    2015-05-07 16:48:27
    赞同 展开评论 打赏
  • 在OSS服务是不会返回417的错误的
    可以看下是否是使用代理的问题
    2015-05-07 16:45:45
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载