cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Develop Android app to upload large file to Dropbox. Failed all the times.

Develop Android app to upload large file to Dropbox. Failed all the times.

SWworker
Explorer | Level 4
Go to solution

Hi,

    I currently develop Android app for user to upload their files to Dropbox. My app can upload <300MB file to user's Dropbox account. But large file is failed all the times. 

    My development environment is Windows 10 and use Android Studio IDE.     I had updated dropbox SDK version to 3.1.1 in Gradle build. And refered to official sample code as below:

DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder("APP Name")
.build();
mDbxClient = new DbxClientV2(requestConfig, accessToken);

    Then I see the log "com.dropbox.core.BadResponseCodeException: unexpected HTTP status code: 413: null" when error happened. Please help me to fix this issue.  Thanks!

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

When using the individual upload method, only files up to 150 MB are officially supported. Attempting to upload larger files, above 300 MB as you found, will fail with that error.

To upload files larger than 150 MB, you'll need to use upload sessions, via uploadSessionStartuploadSessionAppendV2, and uploadSessionFinishBatch. Please refer to the documentation for those methods for more information. There's also an example here.

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

When using the individual upload method, only files up to 150 MB are officially supported. Attempting to upload larger files, above 300 MB as you found, will fail with that error.

To upload files larger than 150 MB, you'll need to use upload sessions, via uploadSessionStartuploadSessionAppendV2, and uploadSessionFinishBatch. Please refer to the documentation for those methods for more information. There's also an example here.

SWworker
Explorer | Level 4
Go to solution

Hi Greg,

    Thank you first.

    I have a question about CHUNKED_UPLOAD_CHUNK_SIZE. In sample code, it has a description "Use a multiple of 4MiB for your chunk size". My question is can I set this value smaller than 4MB?  Is 32KB ok?

Thanks!!

SWworker
Explorer | Level 4
Go to solution

That link seems to be wrong. Could you please provide it again? 

Thanks!!

Greg-DB
Dropbox Staff
Go to solution

@SWworker The CHUNKED_UPLOAD_CHUNK_SIZE value determines how much data to send per individual upload session request, and we recommend using a multiple of 4 MiB due to how the Dropbox backend is implemented.

You can specify a smaller value than 4 MiB, but that generally isn't recommended. That would significantly increase how many requests are needed for the upload session, increasing overhead, and decreasing overall transfer speed. That would only be advantageous in the case where you know the network connection is extremely unreliable, so that retry attempts wouldn't need to re-upload as much.

Otherwise, we recommend something bigger, such as 8 MiB or 12 MiB.

Also, that other post with the link appeared to just be spam. I've removed it accordingly.

Need more support?