title: Upload video to youtube from Android application
body: <p>I am trying to upload a video to YouTube from my Android application, using YouTube API v2.0 – <a href="https://developers.google.com/youtube/2.0/developers_guide_protocol_resumable_uploads#Resumable_uploads" rel="nofollow">Resumable Uploads</a>.</p>
  
  <p>Using that I have completed two steps successfully, but in the third step, where I have to upload the actual video to the url location I got from the step 2, I am getting an error message:</p>
  
  <blockquote>
    <p>Content-Type application/x-www-form-urlencoded is not a valid input type.</p>
  </blockquote>
  
  <p>I am sending the put request using the following protocol:</p>
  
  <pre><code>PUT &lt;upload_url&gt; HTTP/1.1
  Host: uploads.gdata.youtube.com
  Content-Type: &lt;video_content_type&gt;
  Content-Length: &lt;content_length&gt;
  
  &lt;Binary_file_data&gt; 
  </code></pre>
  
  <p>using this code:</p>
  
  <pre><code>HttpPut put=new HttpPut(location);
  InputStream is = new FileInputStream(video_file);
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  byte[] b = new byte[(int) length];
  int bytesRead;
  while ((bytesRead = is.read(b)) != -1) {
    bos.write(b, 0, bytesRead);
  }
  byte[] bytes = bos.toByteArray();
  // ContentType type=
  ByteArrayEntity  byte_entity=new ByteArrayEntity(bytes);
  byte_entity.setContentType("video/3gpp");
  put.setEntity(byte_entity);
  HttpResponse upload_response = client.execute(put);
  </code></pre>
  
  <p>I also tried to send a request using MultipartEntity but every time I am getting the same error <code>Content-Type application/x-www-form-urlencoded is not a valid input type.</code></p>