問(wèn)題描述
我在 Google Docs 上上傳文件為:
I am uploading documents on Google Docs as:
DocumentsService myService = new DocumentsService("");
myService.setUserCredentials("username@domain.com", password );
DocumentEntry newEntry = myService.UploadDocument(@"C:Sample.txt", "Sample.txt");
但是當(dāng)我嘗試上傳 3 MB 的文件時(shí),我得到一個(gè)異常:
But when I try to upload a file of 3 MB I get an exception:
未處理的類型異常'Google.GData.Client.GDataRequestException'發(fā)生在 Google.GData.Client.dll附加信息:執(zhí)行請(qǐng)求失敗:http://docs.google.com/feeds/documents/private/full
An unhandled exception of type 'Google.GData.Client.GDataRequestException' occurred in Google.GData.Client.dll Additional information: Execution of request failed: http://docs.google.com/feeds/documents/private/full
如何將大文件上傳到 Google 文檔?我正在使用 Google API 版本 2.
How can I upload large files to Google Docs? I am using Google API ver 2.
推薦答案
在您的代碼中,您正嘗試上傳 .txt 文件.
In your code you are attempting to upload a .txt file.
這將被轉(zhuǎn)換為 Google Docs文檔"文件.
This will be converted to a Google Docs "Document" file.
可以轉(zhuǎn)換的文件限制為 100 萬(wàn)個(gè)字符(大小為 2Mb).
Files that can be converted are limited to 1 Million characters of (2Mb in size).
如果您將擴(kuò)展名類型更改為 Google 文檔無(wú)法識(shí)別的內(nèi)容(例如 .log),它將允許您上傳最大 10Gb 的文件!雖然免費(fèi)帳戶只有 1Gb 的文件存儲(chǔ)空間.
If you change the extension type to something that is not recognised by Google Docs (for example .log), it will allow you to upload a file of up to 10Gb! Although the free account only has 1Gb of storage for files.
這將允許您通過(guò)應(yīng)用程序存儲(chǔ)和檢索文件,但用戶將無(wú)法使用 Google 文檔界面直接修改它們,盡管他們?nèi)匀豢梢韵螺d文件.
This will allow you to store and retrieve files via your application, but the user will not be able to directly modify them with the Google docs interface, although they can still download it.
這篇關(guān)于無(wú)法將大文件上傳到 Google 文檔的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!