You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

developersSave's avatar
developersSave
Helpful | Level 6
2 years ago

OutOfMemoryError uploading large file from API V2 - Java

Hi everyone, 

I'm trying to upload a ".dump" file (size 3gb) from Java to my Dropbox application, but I've an error because the max size is 150mb.
I'm not finding any examples online, how can I fix that?

Following my code:

 

 

public static FileMetadata uploadDBDump(SuiteConfiguration suiteConfiguration, MultipartFile fileToUpload,
String pathFileName) throws UploadErrorException, DbxException, IOException {
DbxClientV2 dropboxClient = getV2ClientDBDumps(suiteConfiguration);
ListFolderResult folderList = dropboxClient.files().listFolder("");
String dropBoxFolderId = null;
for (Metadata metadata : folderList.getEntries()) {
if (StringUtils.equalsIgnoreCase("/" + pathFileName, metadata.getPathLower())) {
dropboxClient.files().deleteV2(metadata.getPathDisplay());
break;
}
}
CreateFolderResult createFolderV2 = dropboxClient.files().createFolderV2("/" + pathFileName);
dropBoxFolderId = createFolderV2.getMetadata().getId();

UploadBuilder fileUploader = dropboxClient.files()
.uploadBuilder(dropBoxFolderId + "/" + fileToUpload.getOriginalFilename());
fileUploader.withMode(WriteMode.ADD).withMute(Boolean.TRUE).withAutorename(Boolean.TRUE);
FileMetadata uploadMetadata = fileUploader.uploadAndFinish(fileToUpload.getInputStream());
return uploadMetadata;
}


Thank you!

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,888 PostsLatest Activity: 2 days ago
326 Following

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!