小编Joh*_*sen的帖子

尝试使用appscripts将多个文件上传到Google云端硬盘

我试图改变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)

html upload html5 file-upload google-apps-script

10
推荐指数
1
解决办法
1662
查看次数

标签 统计

file-upload ×1

google-apps-script ×1

html ×1

html5 ×1

upload ×1