我已将App Inventor中的图像文件发布到Google Apps脚本网络应用程序。
附加应用程序发明人块图像上传
App Inventor Blocks
以下是针对处理发布请求的Google App脚本WebApp的代码,以便将帖子正文中的图像保存到Google云端硬盘
function doPost(eventInfo) {
MyLog("doPost", "eventInfo", eventInfo.parameters);
if(eventInfo.parameter.type === 'test') {
var destination_id = "0B63z7K35zZN9ZzhEc1NaQV9XaDA";
var img = eventInfo.postData.contents;
var file = Utilities.newBlob(img);
var contentType = "image/jpeg";
MyLog("Test", "check", contentType);
var destination = DriveApp.getFolderById(destination_id);
var driveFile = destination.createFile("Test",file,"image/jpeg");
var fileName = driveFile.getName();
MyLog("doPost", "check", fileName);
}
如何处理postData.contents以将图像文件保存到Google云端硬盘