Skip to content

Instantly share code, notes, and snippets.

final HttpClient client = new DefaultHttpClient();
final HttpPost post = new HttpPost("https://www.googleapis.com/upload/drive/v2/files?uploadType=media");
post.setHeader("Authorization", "Bearer " + authToken);
InputStream inputStream = null;
try {
inputStream = new BufferedInputStream(new FileInputStream(file));
post.setEntity(new InputStreamEntity(inputStream, file.length()));