c# - How to cancel upload in Google Drive API? -
i developing application uploading file in google drive using drive api.i able upload image successfully.but problem is, when cancel uploading not cancelled.i uaing following code:
google.apis.drive.v2.data.file image = new google.apis.drive.v2.data.file(); //set title of file image.title = filename; //set mime type of file image.mimetype = "image/jpeg"; //set stream position 0 because stream readed strm.position = 0; //create request insert file system.threading.cancellationtokensource ctsupload = new cancellationtokensource(); filesresource.insertmediaupload request = app.googledriveclient.files.insert(image, strm, "image/jpeg"); request.chunksize = 512 * 1024; request.progresschanged += request_progresschanged; //visible uploading progress //upload file request.uploadasync(ctsupload.token);
following code written on cancel botton click event
ctsupload.cancel();
based on following answer (google drive sdk: cancel upload) seems google has still issue "unresolved".
in case of need axe found solution.
Comments
Post a Comment