3
A
回答
1
解決方案是上傳文件,你需要使用Python下面一行的讀取數據:
FUNC重刑讀取文件大小
def getSize(self,fileobject):
fileobject.seek(0,2) # move the cursor to the end of the file
size = fileobject.tell()
return size
f = self.request.POST.get('fname').file
media = gdata.data.MediaSource(file_handle=f.read(), content_type=gdata.docs.service.SUPPORTED_FILETYPES[ext], content_length=self.getSize(self.request.POST.get('fname').file))
而且還需要修改谷歌的GDATA python庫來實現這一目標:
client.py:
在 高清upload_file
取代:
while not entry:
entry = self.upload_chunk(start_byte, self.file_handle.read(self.chunk_size))
start_byte += self.chunk_size
With:
while not entry:
entry = self.upload_chunk(start_byte, self.file_handle)
start_byte += self.chunk_size
而且你可以上傳文件目錄谷歌文檔
3
見the documentation,但你可以嘗試這樣的:
ms = gdata.MediaSource(file_path='/path/to/your/test.doc', content_type=gdata.docs.service.SUPPORTED_FILETYPES['DOC'])
entry = gd_client.Upload(ms, 'MyDocTitle')
print 'Document now accessible online at:', entry.GetAlternateLink().href
相關問題
- 1. 使用谷歌應用程序引擎如何在谷歌文檔(Python)的文件上傳
- 2. 上傳文件在谷歌應用程序引擎不工作
- 3. 谷歌應用程序引擎與Django上傳文件錯誤
- 4. 谷歌應用程序引擎文件上傳
- 5. 接線jquery文件上傳到谷歌應用程序引擎
- 6. 如何讓上傳的文件爲使用谷歌應用程序引擎
- 7. 谷歌應用程序引擎和Python
- 8. Mongodb python谷歌應用程序引擎
- 9. 谷歌雲存儲文件在谷歌應用程序引擎中的位置
- 10. 谷歌應用程序引擎python下載文件
- 11. 如何谷歌應用程序引擎報告文件上傳的進度
- 12. 谷歌應用程序引擎:如何顯示HTML文件
- 13. 谷歌應用程序引擎 - 如何添加lib文件夾?
- 14. 在谷歌應用程序引擎
- 15. 在cygwin谷歌應用程序引擎
- 16. 在谷歌應用程序引擎
- 17. 在谷歌應用程序引擎SDK
- 18. 在谷歌應用程序引擎
- 19. java.lang.ClassNotFoundException:sun.security.provider.Sun在谷歌應用程序引擎
- 20. 谷歌應用程序引擎 - 在
- 21. 櫟在谷歌應用程序引擎
- 22. 在谷歌應用程序引擎
- 23. 在谷歌應用程序引擎erlang?
- 24. OAuth在谷歌應用程序引擎
- 25. 在谷歌應用程序引擎
- 26. e.printStackTrace在谷歌應用程序引擎
- 27. JSF在谷歌應用程序引擎
- 28. 在谷歌應用程序引擎JAVA
- 29. KindError在谷歌應用程序引擎
- 30. 谷歌應用程序引擎 - 限制文件大小上載
嗨, 我已經從這個了。我正在使用網絡表單上傳我的文件在Google應用引擎中,現在我想將該文件存儲在Google文檔中 我正在爲該問題找到解決方案 – 2010-06-21 07:58:54