title: Google App Script - Save zip archive uploaded from a google form in drive
body: <p>I'm trying to create a google form in which I ask people to upload a zip file:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;label for=&quot;uploadZip&quot;&gt; Please submit your response in a single zip archive.* &lt;/label&gt;
  &lt;input type=&quot;file&quot; name=&quot;uploadZip&quot; required /&gt;
  </code></pre>
  <p>In <code>.gs</code> script I tried:</p>
  <pre class="lang-js prettyprint-override"><code>function doGet(e) {
    return template = HtmlService.createHtmlOutputFromFile('form.html');
    return template.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME);
  }
  
  function uploadFiles(form) {
  
    try {
  
      var rootID = &quot;MyRootID&quot;;
      var root = DriveApp.getFolderById(rootID);
      var directory = &quot;AllUploadZips&quot;;
      var folders = root.getFoldersByName(directory);
      
      if (folders.hasNext()) {
        folder = folders.next();
      } else {
        folder = root.createFolder(directory);
      }
  
      var foldername = form.myLastName + &quot;, &quot; + form.myFirstName;
      var myFolder = folder.createFolder(foldername);
      var zip = form.uploadZip;
      var file_zip = myFolder.createFile(zip);
  
    } catch (error) {
  
      return error.toString();
  
    }
  }
  </code></pre>
  <p>This will save the zip file in <code>&quot;AllUploadZips/myLastName, myFirstName/&quot;</code> in my drive. However the zip is broken with the following error message:</p>
  <pre class="lang-sh prettyprint-override"><code>$ unzip myZip.zip
  Archive:  myZip.zip
    End-of-central-directory signature not found.  Either this file is not
    a zipfile, or it constitutes one disk of a multi-part archive.  In the
    latter case the central directory and zipfile comment will be found on
    the last disk(s) of this archive.
  unzip:  cannot find zipfile directory in one of myZip.zip or
          myZip.zip.zip, and cannot find myZip.zip.ZIP, period.
  </code></pre>
  <p>The script works fine if I had instead uploaded a <code>.txt</code> or <code>.pdf</code>. It's just having problem with zip files. Does anyone have any idea what's going on? Thanks a lot!</p>