Google云端硬盘可恢复上传 [英] Google Drive Resumable Uploads

查看:86
本文介绍了Google云端硬盘可恢复上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法请求可恢复上传的当前状态.根据 Google文档,以下请求应返回我上传的带有Google当前范围的Range标头,但我不断收到以下响应:

I am having trouble requesting the current status of a resumable upload. Based on the Google Documentation, the following request should return a Range header with the current range google has of my upload, but I keep getting the following response:

无法解析Content-Range标头

Failed to parse Content-Range header

这是我的卷曲要求:

curl -H "Content-Range: bytes */1443452365" -H "Content-Length: 0" locationUrl -X PUT

我还尝试过"bytes */*" "*/*" 作为Content-Range标头,但是没有运气.

I have also tried "bytes */*" and "*/*" for the Content-Range header, but no luck.

有什么想法吗?

推荐答案

首先,您需要检查正确的请求格式,例如以下示例:

First, you need to check the correct request format like the sample given below:

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do

然后,在其他命令行工具中进行讨论,在发送原始HTTP数据时,请注意 POST PUT 操作将需要计算 Content-Length 标头的值.您可以使用UNIX工具 wc 来计算该值.将HTTP正文的所有内容放入文本文件,例如 template_entry.xml (上面的示例),然后运行 wc -c template_entry.xml .如果不小心为Content-Length标头使用了不正确的值,通常很难调试.

And, discussed in other command-line tools, when sending raw HTTP data, be aware that the POST and PUT operations will require computing the value for a Content-Length header. You can use the UNIX tool wc to compute this value. Place all the content of the HTTP body into a text file such as template_entry.xml (example used above) and run wc -c template_entry.xml. It is often difficult to debug if you accidentally use an incorrect value for the Content-Length header.

最后,您可以请求块之间的状态,而不仅仅是上载被中断.如果上传请求被中断,请按照恢复被中断的内容中概述的过程进行操作.上传.

Lastly, you can request the status between chunks, not just if the upload is interrupted. If the upload request is interrupted, follow the procedure outlined in resume an interrupted upload.

这篇关于Google云端硬盘可恢复上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆