[英]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.