Skip to content

Unable to resuming an interrupted upload #897

@GoogleCodeExporter

Description

@GoogleCodeExporter
google-api-java-client-1.18.0-rc
google-api-services-drive-v2-rev135-1.18.0-rc

Java environment: Android 443

Describe the problem.

It seems that MediaHttpUploader.upload() did not handle resume upload well. 
The reason is that "1) Request the upload status." mentioned in "Google Drive 
SDK, Upload Files" always fail to get "Content-Range".
https://developers.google.com/drive/web/manage-uploads#resumable

My test step is try to disconnect WiFi/connect to another WiFi during upload, 
and then upload the same file again, but it always upload the file from 
beginning.

Code(cannot resume an interrupted upload):

insert = getDriveService().files().insert(fileMetadata, mediaContent);
MediaHttpUploader mediaUploader = insert.getMediaHttpUploader();
mediaUploader.setDirectUploadEnabled(false);
mediaUploader.setProgressListener(mUploadFileProgressListener);
mediaUploader.setChunkSize(MediaHttpUploader.MINIMUM_CHUNK_SIZE);
mediaUploader.upload(insert.buildHttpRequestUrl());


How would you expect it to be fixed?

1) Google drive server should respond "Content-Range" with "HTTP/1.1 308 Resume 
Incomplete"
2) If server is allow to NOT response "Content-Range", the way to solve it is 
polling "Content-Range" all the time during upload. Thus, it able to resuming 
an interrupted upload by "Resume the upload from the point where it left off."


Original issue reported on code.google.com by kaifu.c...@gmail.com on 15 Aug 2014 at 8:18

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions