title: Uploading file to Google Drive using resumable API
body: <p>I have  a quite large file that I am trying to upload to google drive using the API. I am trying to do it with a sample image for learning purposes. Uploading the image as a multiplart upload or a single file upload works without hesitation, but the moment I try to do it using the resumable upload endpoint, the code gives me a error as:</p>
  
  <pre><code>{
   "error": {
    "errors": [
     {
      "domain": "global",
      "reason": "badContent",
      "message": "Unsupported content with type: image/jpeg"
     }
    ],
    "code": 400,
    "message": "Unsupported content with type: image/jpeg"
   }
  }
  </code></pre>
  
  <p>The code that I am using is as follows:</p>
  
  <pre><code>import requests
  import os
  filesize = os.path.getsize('./photo.jpeg')
  print("File size is: ", filesize)
  
  headers = {"Authorization" : "Bearer "+"&lt;MY API KEY HERE&gt;",
          "Content-Length": str(filesize),
          "Content-Type": "image/jpeg"}
  params = {
          "name": "sample.png",
          "parents": ['1CxrbEfy5y3ZyBVF6k2IFIuOk_Z0wjZAo']
          }
  files  = {
          'data': ('metadata', json.dumps(params), 'image/jpeg'),
          'file': open('./photo.jpeg', 'rb')
          }
  
  r = requests.post(
          "https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable",
          headers = headers,
          files = files
          )
  print(r.text)
  </code></pre>
  
  <p>Please help.</p>