0
严格按照谷歌教程教程(google drive resumable upload)。 最初的POST请求是成功的。通过请求,我发送了一些元数据(文件标题),并收到了包含upload_id
参数的Location
标题的响应。我保存该uri并开始我的分块上传过程。谷歌驱动器API 400分块文件上传错误请求
我打算发布来自Chrome开发人员工具网络标签的请求,这会显示我可能错过的任何内容。
Remote Address:xxx.xxx.xx.x:443
Request URL:https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable&upload_id=AEn...
Request Method:PUT
Status Code:400 Bad Request
Request Headers
:host:www.googleapis.com
:method:PUT
:path:/upload/drive/v2/files?uploadType=resumable&upload_id=AEn...
:scheme:https
:version:HTTP/1.1
accept:*//*
accept-encoding:gzip,deflate
accept-language:en-US,en;q=0.8,et;q=0.6,ja;q=0.4,ru;q=0.2,de;q=0.2
authorization:Bearer ya29...
cache-control:no-cache
content-length:204800
content-range:bytes 0-204799/9623941
content-type:application/x-msdownload
origin:http://localhost:8080
pragma:no-cache
referer:http://localhost:8080/index.html
user-agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
x-client-data:CI62yQEIprbJAQiptskBCMS2yQEInobKAQi4iMoBCPGIygE=
Query String Parameters
uploadType:resumable
upload_id:AEn...
Response Headers
access-control-allow-origin:http://localhost:8080
access-control-expose-headers:Content-Length, Content-Type, Date, Server, Transfer-Encoding
alternate-protocol:443:quic,p=0.01
content-length:193
content-type:application/json; charset=UTF-8
date:Sun, 28 Sep 2014 17:50:48 GMT
server:UploadServer ("Built on Sep 18 2014 17:00:06 (1411084806)")
status:400 Bad Request
vary:Origin
version:HTTP/1.1
忽略accept头中的第二个斜杠。
这是我开始第一个块上载后得到的回应。根据谷歌的参考,一切似乎都是正确的,但它不起作用。
我没有使用googles client.js库。使用普通的旧XMLhttpRequest()
。
您可以发布原始的POST和响应。你确定mime类型是“application/x-msdownload”吗? – pinoyyid 2014-09-29 12:22:32
@pinoyyid昨天Google似乎有问题。激发我的应用程序,它像一个魅力,得到适当的回应等。 – ejx 2014-09-29 17:09:41