Hello developers,
I want to upload image taken by camera to the google drive using UpLOAD Any File To Google Drive with AI2 method. when I use this, it uploads with my given name and has google id but it is an empty file with 0kb size and no preview. when I upload image by image picker manually it is ok. Here these are my blocks:
This is my web App and yes it is according your guide and deployed correctly:
function doPost(e) {
var contents = JSON.parse(e.postData.contents.replace(/\n/g, ""));
var fileName = contents.filename;
var data = Utilities.base64Decode(contents.file);
var blob = Utilities.newBlob(data, e.postData.type, fileName);
var folderId = "1VLaDQmo59T9pwQtNBT-XXXXXXXXX"; // Ensure the folder ID is a string
var fileId = DriveApp.getFolderById(folderId).createFile(blob).getId();
return ContentService.createTextOutput('{"fileName": "'+ fileName + '", "fileId": "' + fileId + '"}');
}
when I upload from image picker or camera I will see the google ID include file name.
No, I am able to upload to destination folder in google drive from both image picker and camera without signing in to the google drive, uploading from image picker manually is ok, but when upload from camera it has name and google ID, but is 0kb and I can not use it anywhere.
Please check the below .AIA, PhotoUploadCheck.aia (9.4 KB)