我刚刚开始使用 GAS,但在将文件上传到 GDrive 文件夹时遇到问题。
我使用这种方式读取表单(html+bootstrap)文件输入并将文件生成到驱动器文件夹中。表单上有 4 个针对不同主题的文件输入。
function processForm(theForm) { //Variables from files to upload var talleres = theForm.talleres; var sistEval = theForm.sistEval; var otrosDoc = theForm.otrosDoc; var matsDigi = theForm.matsDigi; var folder = DriveApp.getFolderById(folderId); var nombTuto = theForm.curso+'_'+theForm.nombre+'_'+theForm.paterno+'_'+theForm.materno; var foldTuto = DriveApp.createFolder(nombTuto); var doc = foldTuto.createFile(talleres); var doc2 = foldTuto.createFile(sistEval); var doc3 = foldTuto.createFile(otrosDoc); var doc4 = foldTuto.createFile(matsDigi); folder.addFolder(foldTuto); DriveApp.removeFolder(foldTuto);
我已经通过对 form.html 进行 js 验证将文件大小限制为每个文件 100Mb,但是当我尝试上传总共超过 50Mb(考虑到 4 个文件)时,bugzilla 的控制台会返回消息:
NetworkError: Connection failure due to HTTP 500
网络被卡住,显然没有保存任何东西。
所以,我需要知道是否必须更改上传方法,因为我正在搜索 GAS 页面的文档,但找不到有关“上传配额”的任何信息或错误 500 中的详细信息,就像“内部服务器错误”。
抱歉我的英语不好,问候。
最佳答案
对于 Google Apps 脚本的驱动器服务,每次上传的限制设置为 10MB。我猜想 Blob 函数与其他函数具有相同的限制,这是 Google 的疏忽。
Throws an exception if content is larger than 10MB.
我猜这个限制是由于 limitation of URL Fetch POST size .
关于javascript - 通过谷歌应用脚本将文件上传到谷歌驱动器时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39705837/