Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

developersSave's avatar
developersSave
Helpful | Level 6
3 years ago
Solved

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.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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, Facebook or Instagram.

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!