I have a form, which allows to select an item from a dropdown list and upload a file. The name and the ID of the item are saved in a Spreadsheet document. Works with one file...but I want to upload multiple files. Could you help me fixing the script?
The HTML part looks like this
<div class="col-md-4 col-sm-6 ">
<div class="caption">
<h3>Bildauswahl</h3>
<p align="center"><input type="file" name="myFiles[]" id="myFiles" multiple></p>
</div>
</div>
My script, which is not working, is the following:
var dropBoxId = "XYZ";
var logSheetId = "ABC";
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('InputForm.html');
}
function uploadFiles(formObject) {
try {
// Create a file in Drive from the one provided in the form
var folder = DriveApp.getFolderById(dropBoxId);
var input = document.getElementById('myFiles');
for (i = 0; i<input.files.length; i++) {
var blob = input.files[i];
var file = folder.createFile(blob);
var ss = SpreadsheetApp.openById(logSheetId);
var sheet = ss.getSheets()[0];
sheet.appendRow([file.getName(), file.getUrl(), formObject.myName]);
}
// Return the new file Drive URL so it can be put in the web app output
return file.getUrl();
} catch (error) {
return error.toString();
}
}
Thanks.
I am following a tutorial [here][1] to make a Facebook like friend tagging system. But the tutorial lacks the "arrow navigating" capability like Facebook. I would like to figure out how to achieve ...
I am following a tutorial [here][1] to make a Facebook like friend tagging system. But the tutorial lacks the "arrow navigating" capability like Facebook. I would like to figure out how to achieve ...
I am using Trisquel 7.0. I've some basic knowledge about html and JavaScript. Now I want to save html form data to file (Also interested in loading/filling html form from file). I searched and found ...
I am using Trisquel 7.0. I've some basic knowledge about html and JavaScript. Now I want to save html form data to file (Also interested in loading/filling html form from file). I searched and found ...
Setup: leftItems & rightItems are arrays of 5 digit ID's. matchedItems is an array of all those ID's - there a lots of results with the same ID. $matches is a div to which I want to append results ...
Setup: leftItems & rightItems are arrays of 5 digit ID's. matchedItems is an array of all those ID's - there a lots of results with the same ID. $matches is a div to which I want to append results ...
I'm trying to display the time it takes a function to complete in javascript, and then display the time in an alert window that is called on button click, however the alert box doesn't pop up at all ...
I'm trying to display the time it takes a function to complete in javascript, and then display the time in an alert window that is called on button click, however the alert box doesn't pop up at all ...