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. 谷歌應用程序引擎和Python
- 4. 谷歌應用程序引擎python下載文件
- 5. 在谷歌應用程序引擎
- 6. 在谷歌應用程序引擎
- 7. 在谷歌應用程序引擎JAVA
- 8. 在cygwin谷歌應用程序引擎
- 9. 在谷歌應用程序引擎SDK
- 10. 在谷歌應用程序引擎
- 11. KindError在谷歌應用程序引擎
- 12. 在谷歌應用程序引擎
- 13. 在谷歌應用程序引擎
- 14. 谷歌應用程序引擎 - 限制文件大小上載
- 15. 在的Joomla靜態文件的谷歌應用程序引擎
- 16. 用谷歌應用引擎上傳和解析csv文件
- 17. PHP SCANDIR()在谷歌應用程序引擎只返回 '.PHP' 文件谷歌應用引擎
- 18. WebTest的谷歌應用程序引擎
- 19. 谷歌應用程序引擎的Bigtable
- 20. 谷歌應用程序引擎的phpBB
- 21. Django的谷歌應用程序引擎
- 22. 上傳並加密從谷歌應用程序引擎的任何文件
- 23. 提供靜態文件,而在谷歌應用程序引擎
- 24. 谷歌雲SQL和谷歌應用程序引擎
- 25. 與谷歌應用程序引擎谷歌Prediction API進行
- 26. java +谷歌網絡工具包(谷歌應用程序引擎)
- 27. 如何在谷歌應用程序引擎(Python)中創建一個Excel文件?
- 28. 如何從谷歌應用程序引擎查詢在python
- 29. 谷歌應用程序引擎_method?
- 30. Pinax谷歌應用程序引擎
嗨, 我已經從這個了。我正在使用網絡表單上傳我的文件在Google應用引擎中,現在我想將該文件存儲在Google文檔中 我正在爲該問題找到解決方案 – 2010-06-21 07:58:54