Google Docs Api v3 upload zip permissions
According to the docs a开发者_JAVA技巧ny file type can now be uploaded to Google Docs, however my upload script always returns:
403 You do not have permission to perform this operation.
It works fine with plain text documents and version 1 (not 3 as below). I'm trying to upload a tar.gz with mime type "application/x-gzip". I have a feeling it's the mime that's kicking it out. I also have the convert parameter set to false.
I'm using Zend Framework to do this but setting the version (GET parameter v) to 3 (1 won't let this work).
This is the code, very simple:
$client = Zend_Gdata_ClientLogin::getHttpClient(self::USER, self::PASS, Zend_Gdata_Docs::AUTH_SERVICE_NAME);
$docs = new Zend_Gdata_Docs($client);
$result = $docs->uploadFile($latest,
'Backup: '.$filename,
'application/x-gzip',
'https://docs.google.com/feeds/default/private/full?v=3&convert=false');
What am I missing?
Turns out you need to use an resumable upload link, as this is the only one to support any file type.
http://code.google.com/apis/documents/forum.html?place=topic%2Fgoogle-documents-list-api%2FMdfqFMS4yHI%2Fdiscussion
If anyone needs help: http://www.needathinkle.com/tumblr/view/6431275496
精彩评论