seth
seth

Reputation: 1389

Upload file synchronously

Is there a way to upload a file synchronously?

I'm using ASP.NET 4.0 for my web app and since the file sizes will always be relatively small (< 100kb), the waiting time is not an issue.

Upvotes: 1

Views: 554

Answers (1)

Claudio Cherubino
Claudio Cherubino

Reputation: 15014

The Google Drive API supports synchronous file uploads.

Check the files.insert method in the Reference guide for more details: https://developers.google.com/drive/v2/reference/files/insert

The snippet below is taken from the documentation:

...
FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream, mimeType);
request.Upload();

File file = request.ResponseBody;
...

The call to request.Upload will return when the upload is completed and request.ResponseBody will contain the file metadata from the response.

Upvotes: 2

Related Questions