我想要http将图像从html表单发布到谷歌应用程序脚本web应用程序,然后将该图像添加到谷歌驱动器。如何将jpg或png转换为Google应用程序脚本上的blob?
我的应用程序脚本如下。
function doPost(e){
var date = new Date();
var timestamp = date.toString()
var adress = e.parameter.adress;
var cost = e.parameter.cost;
var item = e.parameter.item;
var check = e.parameter.image;
//add file to drive
var destination_id = "some ID"
var destination = DriveApp.getFolderById(destination_id);
destination.createFile(check);
};
当我执行时,它返回一个错误; cannot find method: createFile(String)
我认为这是因为“check”是一个字符串,我想将提交的图像转换为Blob。 我该怎么做?
本文介绍如何上传图像到GAS:[GAS-upload-image](http://stackoverflow.com/questions/21593249/uploading-images-to-a-google-spreadsheet-using-apps-脚本) –