【发布时间】:2012-11-16 08:38:14
【问题描述】:
我在使用新的 google drive API 客户端库的文档时遇到了严重问题。看起来这应该很容易回答,而不必将其放在 stackoverflow 上。我正在认真考虑推出我自己的这个,一个“正常工作”的 64 页库到目前为止是一个“令人头疼的问题”
你到底是如何将uploadType 设置为“resumable”而不是默认的“simple”的。我已经在图书馆中搜索了一种方法来做到这一点,但它似乎不存在。他们唯一的提示是他们的示例上传页面上的代码https://developers.google.com/drive/quickstart-php
//Insert a file
$file = new Google_DriveFile();
$file->setTitle('My document');
$file->setDescription('A test document');
$file->setMimeType('text/plain');
$data = file_get_contents('document.txt');
$createdFile = $service->files->insert($file, array(
'data' => $data,
'mimeType' => 'text/plain',
));
这里没有设置uploadType...???
他们在另一个页面上的docs 只是将uploadType 显示为GET 地址的一部分:https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable 但是当您使用$service->files->insert 时,库会设置地址。
【问题讨论】:
-
如果谷歌只有一组类似于 jQuery 文档库的文档,那么所有这些类型的问题都可以避免。如果他们至少有一个在线某个地方按类排序的 php 客户端库中所有可用方法的列表,那就太棒了。有这样的东西吗?
标签: php google-drive-api google-api-php-client