Create files

To create a file that contains no metadata or content, use the files.create method with no parameters. The file is given a kind of drive.file, an id, a name of "Untitled," and a mimeType of application/octet-stream.

Upload thumbnails

Drive automatically generates thumbnails for many common file types. For file types that Drive can't render, you can provide a thumbnail image generated by your application. During file creation or update, upload a thumbnail by setting the contentHints.thumbnail fields on the File resource. Specifically,

  • Set thumbnail.image to the URL-safe Base64-encoded image (see RFC 4648 section 5)
  • Set thumbnail.mimeType to the appropriate type for the image format.

If Drive can generate a thumbnail from the file, then it uses the generated one and ignores any you may have uploaded. If it can't generate a thumbnail, it uses the one you provide.

Thumbnails should adhere to these rules:

  • Thumbnails may be uploaded in PNG, GIF, or JPG formats.
  • The recommended width is 1600px.
  • The maximum file size for a thumbnail is 2MB.
  • The minimum width for thumbnails is 220px.
  • Thumbnails should be updated by your application with each save.

For more information, see the Files reference.

Next Steps

Here are a few next steps you might try: