我试图改变ctrlq的代码(在这里找到:http://ctrlq.org/code/19747-google-forms-upload-files ),以便上传多个文件而不是1.
这是我到目前为止:HTML:
<form id="myForm">
<input type="text" name="myName" placeholder="Name">
<input type="password" name="psw" placeholder="Password">
<input type="text" name="myFolder" placeholder="Folder Name">
<input type="file" name="myFile" id="filesID" multiple>
<input type="submit" value="Upload File"
onclick="this.value='Uploading..';
google.script.run.withSuccessHandler(fileUploaded)
.uploadFiles(this.parentNode);
return false;">
</form>
<div id="output"></div>
<script>
function fileUploaded(status) {
document.getElementById('myForm').style.display = 'none';
document.getElementById('output').innerHTML = status;
}
</script>
<style>
input { display:block; margin: 20px; }
</style>
Run Code Online (Sandbox Code Playgroud)
Google脚本:
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('form.html');
}
function uploadFiles(form) {
try {
var input = document.getElementById('filesID');
var dropbox = "User Files";
var folder, …Run Code Online (Sandbox Code Playgroud)