File mediaFile = new File("/tmp/driveFile.jpg");
InputStreamContent mediaContent =
new InputStreamContent("image/jpeg",
new BufferedInputStream(new FileInputStream(mediaFile)));
mediaContent.setLength(mediaFile.length());
Drive.Files.Insert request = drive.files().insert(fileMetadata, mediaContent);
request.getMediaHttpUploader().setProgressListener(new CustomProgressListener());
request.execute();
please refer to http://code.google.com/p/google-api-java-client/wiki/MediaUpload
I use the above code for verification and found that you can upload
successfully, but to start from scratch every time, rather than by way of
resume, please help to provide a sample of Resuming an upload to google cloud
for me, thanks!
Original issue reported on code.google.com by ganxinas...@gmail.com on 2 Dec 2013 at 8:39
Original issue reported on code.google.com by
ganxinas...@gmail.com
on 2 Dec 2013 at 8:39