One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
GabrielSMF
6 years agoNew member | Level 2
OutOfMemoryError uploading large file from API V2 - Java
Hi all,
I'm trying to upload a large file (24gb) from Java using the Droopbox API V2, but I have a Out Of Memory Error.
I'm using the next line to do the upload:
cli.files().uploadBuilder(file_path_dropbox).uploadAndFinish(in);
Where:
file_path_dropbox = The path to Dropbox
in = the InputStream generated from FileInputStream(pathLocalFile)
I had read that I can use the uploadSessionStart() to do large uploads, but I never used it previously and I don't find some example of this.
How can I fix it?
Regards
- Greg-DB
Dropbox Staff
The upload method you're using only officially supports files up to 150 MB. If you need to upload larger files, such as the 24 GB file you mentioned, you'll need to use upload sessions, like you said. You can find an example of doing so in the official Dropbox API v2 Java SDK here:
You can find the documentation for the upload session methods here:
- https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.1.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#uploadSessionStart--
- https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.1.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#uploadSessionAppendV2-com.dropbox.core.v2.files.UploadSessionCursor-
- https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.1.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#uploadSessionFinish-com.dropbox.core.v2.files.UploadSessionCursor-com.dropbox.core.v2.files.CommitInfo-
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 22 hours ago
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!