The code below contains the createFile() API, it expects a single object (named "file" here). In this way the file can be saved in some google drive folder
function uploadFiles(data)
{
var file = data;
var folder = DriveApp.getFolderById('1UWGb5Mzr9VzPUuQTr9CWD7EMYNEAzyuC');
var createFile = folder.createFile(file);
return createFile.getUrl();
}
Now I want to combine this function to another webpage. However, the script in another webpage is below:
for (clipIndex = 0; clipIndex < unrollWordCounts(getAllWantedWords()).length; clipIndex++) {
try {
var clip = allClips[clipIndex];
clip.style.display = 'None';
var audioBlobUrl = clip.querySelector('audio').src;
var word = clip.querySelector('p').innerText;
var filename = word + '_' + Date.now() + '.ogg';
saveAs(audioBlobUrl, filename);
google.script.run.withSuccessHandler(onSuccess).uploadFiles(audioBlobUrl);
}
The data I want to upload to google drive is audioBlobUrl. However, the createFile() of app script expect a file. It seems like audioBlobUrl is not a file. How should I modify the code, so that it can pass the expected data to google createFile() to achieve my aim?