简体   繁体   English

Google云端硬盘脚本未上传大于10MB的文件

[英]Google drive script not uploading file larger than 10MB

I copied a basic example to upload a file to Google drive automatically using Google-script. 我复制了一个基本示例,使用Google脚本自动将文件上传到Google云端硬盘。 Drive.Files.insert works for images (png files) and DriveApp.createFile works for text file types. Drive.Files.insert适用于图像(png文件),DriveApp.createFile适用于文本文件类型。 But i am trying to upload a backup.tar.bz2 file which is larger than 10M. 但我正在尝试上传大于10M的backup.tar.bz2文件。 Every time the process executes it uploads 10MB and it stops. 每次进程执行时上传10MB并停止。 I read somewhere that there is no 10MB limit on non-google file types and i could upload file as big as i want (i think its 1 TB). 我在某处读到非谷歌文件类型没有10MB的限制,我可以上传我想要的文件(我认为它的1 TB)。 I am manually able to upload the same file via the google drive web page. 我手动可以通过谷歌驱动器网页上传相同的文件。

Can some one please point me to the right direction or give me an example of code that works for > 10MB binary object? 有人可以指出我正确的方向或给我一个代码适用于> 10MB二进制对象的例子? Thank you. 谢谢。

UPDATE: I am able to upload a zip file less than 10MB in size. 更新:我可以上传一个小于10MB的zip文件。

function uploadFile() {
  var image = UrlFetchApp.fetch('http://example.com/files/backup.tar.bz2').getBlob();
  var file = {
    title: 'backup.tar.bz2',
    mimeType: 'application/bz2'
  };
 // file = Drive.Files.insert(file, image); -- ANOTHER WAY OF DOING IT
    DriveApp.createFile(image);
  //Logger.log('ID: %s, File size (bytes): %s', file.id, file.fileSize);
  Logger.log(image.getName() + "    " + image.getBytes());
};

I'm afraid the documentation to DriveApp.createFile mentions 我担心DriveApp.createFile提供的文档

Throws an exception if content is larger than 10MB 如果内容大于10MB,则引发异常

for all variants except the Blob one, but I suspect it's just an oversight. 除了Blob之外的所有变种,但我怀疑它只是一个疏忽。 It looks related to the POST quota and is mentioned anyway in several support tickets (see for instance #552 , #2806 ). 它看起来与POST配额有关,无论如何都会在几个支持票据中提到(例如参见#552#2806 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Android应用程序中无法访问大于10mb的文件 - Unable to access file larger than 10mb in Android application Payload Too Large - 当尝试上传大于 10MB 的文件时,在 dropzone.js 的控制台中说 - Payload Too Large - says in console from dropzone.js when try to upload file larger than 10MB php:// input对于小于10MB的请求为空 - php://input is empty for requests less than 10MB 使用(event.target作为FileReader).result上传较大文件时,Google Chrome崩溃。 (文件大小超过80mb) - Google chrome crashing while uploading larger files using (event.target as FileReader).result . (File size greater than 80mb) webpack 生产构建 bundle.js 文件大小为 10mb - webpack production build bundle.js file size is 10mb html离线存储〜10MB跨浏览器解决方案 - html offline storage ~10MB cross-browser solution 使用Apps脚本将图像上传到Google云端硬盘 - Uploading image to Google Drive using Apps Script 使用gapi将文件上传到Google云端硬盘 - Uploading a file to Google Drive using gapi Google云端硬盘上传文件大小限制 - Google Drive uploading file size limit 将文件上传到Google云端硬盘:权限不足 - Uploading a File to Google Drive : Insufficient Permission
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM