使用 zend gdata 插件上传文档
我正在尝试使用 Zend_Gdata
插件将文档上传到 Google 文档。它上传得很好。
但该文档默认变为私有。我怎样才能将其设置为公开。如何获取我的文档的文档 ID 和 URL 链接,以便其他人只能访问它以进行查看?
$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, $service);
$docs = new Zend_Gdata_Docs($client);
$feed = $docs->getDocumentListFeed();
$newDocumentEntry = $docs->uploadFile(
$filename, $name, null, Zend_Gdata_Docs::DOCUMENTS_LIST_FEED_URI
);
我很感激任何帮助。
谢谢
I am trying to upload a document into Google docs using the Zend_Gdata
plugin. It uploads fine.
But the document by default becomes private. How can I set it to public. And how can I get the doc id and URL link to my doc so that others can access it to view only?
$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, $service);
$docs = new Zend_Gdata_Docs($client);
$feed = $docs->getDocumentListFeed();
$newDocumentEntry = $docs->uploadFile(
$filename, $name, null, Zend_Gdata_Docs::DOCUMENTS_LIST_FEED_URI
);
I appreciate any help.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须提供一个不同的 URI 作为
uploadFile()
函数的第四个参数,您使用的 URI 会将文档发送到私有。 (观察下面)从
Zend_Gdata_Docs
查看源代码。如您所见,类
const
链接到私有路径。您必须使用 public,而不是使用Zend_Gdata_Docs::DOCUMENTS_LIST_FEED_URI
。 但是,根据 Google 文档列表 Feed API,看来他们只接受私有。顺便说一句,最终结果应该返回一个
Zend_Gdata_App_Entry
对象到$newDocumentEntry
,我认为你应该能够调用像$newDocumentEntry->getEditLink 这样的函数()
等。如果您想查看该对象中还存储了什么内容:
祝您好运!
You must supply a different URI as the fourth parameter to the
uploadFile()
function, the one you're using will send docs to private. (Observe below)Check out the source code from
Zend_Gdata_Docs
.As you can see, the class
const
is linking to a private path. Instead of usingZend_Gdata_Docs::DOCUMENTS_LIST_FEED_URI
, you would have to use public. However, according to Google's Documents List Feed API, it appears they only accept private.By the way, the end result should return a
Zend_Gdata_App_Entry
object to$newDocumentEntry
with which I think you should be able to call functions like$newDocumentEntry->getEditLink()
etc.If you want to see what else is stored in that object that do this:
Good luck!