Trying to set file thumbnail to Google Drive using javascript
<p>I am trying to add a thumbnail to my files that I am uploading to Drive using Javascript. I am trying to follow the directions at <a href="https://developers.google.com/drive/v3/web/file#uploading_thumbnails" rel="nofollow">https://developers.google.com/drive/v3/web/file#uploading_thumbnails</a></p>

<p>To create my web-safe base64 image, I converted a simple red-square image to base64 using an online converter, which produced</p>

<p><code>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4z8DwHwAFAAH/VscvDQAAAABJRU5ErkJggg==</code></p>

<p>then I took everything following <code>data:image/png;</code> and replaced <code>/</code> with <code>_</code> and removed the <code>=</code>'s:</p>

<p><code>iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4z8DwHwAFAAH_VscvDQAAAABJRU5ErkJggg</code></p>

<p>I then added the following to my original header in my request:</p>

<pre><code>contentHints: {
    thumbnail: {
      image: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4z8DwHwAFAAH_VscvDQAAAABJRU5ErkJggg",
      mimeType: "image/png"
    }
  }
</code></pre>

<p>However, I am failing to see any thumbnails for my files, in either the list or grid view in Google Drive.</p>

<p>Any thoughts as to what's going on?</p>

<p>Here's my entire file-saving code:</p>

<pre class="lang-js prettyprint-override"><code>function saveFile(content) {
  var boundary = '-------314159265358979323846';
  var header = JSON.stringify({
    title: "My file",
    mimeType: "application/myFile",
    parents: ['root'],
    contentHints: {
      thumbnail: {
        image: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4z8DwHwAFAAH_VscvDQAAAABJRU5ErkJggg",
        mimeType: "image/png"
      }
    }
  });
  var method = 'POST';
  var path = "/upload/drive/v2/files";

  var body = [
    "\r\n--" + boundary + "\r\nContent-Type: application/json\r\n\r\n" + header,
    "\r\n--" + boundary + "\r\nContent-Type: " + this.mimeType + "\r\n\r\n" + (content.getContentAsJSON()),
    "\r\n--" + boundary + "--"].join('');

  var request = gapi.client.request({
    path: path,
    method: method,
    params: {
      uploadType: 'multipart'
    },
    headers: {
      'Content-Type': 'multipart/related; boundary="' + boundary + '"'
    },
    body: body
  });

  request.execute(file);
};
</code></pre>