title: Google Drive API v3 uploads 'Untitled' file every time I try to upload something with Javascript
body: <p>So the drive documentation is for NodeJs and i'm using plain JS. I can upload with no problem however the files appear to be uploaded incorrectly as 'Untitled' and unopenable</p>
  <pre><code>var file = document.getElementById('input-file').files[0];
  
  var fileMetadata = {
      'parents': ['0AN75N3P23eTJUk9PVA'], // Folder ID at Google Drive
      'name':
          cliente + '.' + file.name.substring(file.name.lastIndexOf('.') + 1) // Filename at Google Drive
  };
  var r = new FileReader();
  r.readAsText(file);
  r.onload = function (e) {
      var body = r.result;
      var media = {
          mimeType: file.type,
          body: body
      };
  
  
      gapi.client.drive.files.create({
          resource: fileMetadata,
          media,
          fields: 'id'
      })
          .then(response =&gt; {
              console.log('response: ', response);
          })
          .catch(() =&gt; {
              console.log('something is wrong');
          });
  }
  </code></pre>