I would like to upload a file using Google Drive API. I have looked at Google Drive API for Java and Google Drive API Javadoc, but I don't see anything.
-
I think this is what you're looking for?Polyov– Polyov2016-08-27 15:35:27 +00:00Commented Aug 27, 2016 at 15:35
-
@Polyov that is not using Java APItsaebeht– tsaebeht2016-08-27 16:40:33 +00:00Commented Aug 27, 2016 at 16:40
-
If you scroll down to here you'll see that they have examples for multiple languages, including Java. The first part just deals with the technical aspects of the REST api.Polyov– Polyov2016-08-27 17:10:33 +00:00Commented Aug 27, 2016 at 17:10
-
Possible duplicate of upload file into google drive using java apiLaurel– Laurel2016-08-27 18:43:39 +00:00Commented Aug 27, 2016 at 18:43
-
Have you resolved this?ReyAnthonyRenacia– ReyAnthonyRenacia2016-09-13 05:39:29 +00:00Commented Sep 13, 2016 at 5:39
Add a comment
|
1 Answer
The Uploading Files in Drive API that @Polyov gave you contains a Java code snippet:
File fileMetadata = new File();
fileMetadata.setName("My Report");
fileMetadata.setMimeType("application/vnd.google-apps.spreadsheet");
java.io.File filePath = new java.io.File("files/report.csv");
FileContent mediaContent = new FileContent("text/csv", filePath);
File file = driveService.files().create(fileMetadata, mediaContent)
.setFields("id")
.execute();
System.out.println("File ID: " + file.getId());
Whichever language you use, the concepts remain the same like there will always be the 3 types of uploading, namely: simple upload, multipart and resumable.
There's a Java Quickstart to get you started.
If you're looking for more code samples check this github repo for your reference.
1 Comment
Nathani Software
I don't think this is multipath upload.