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.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

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

OutOfMemoryError uploading large file from API V2 - Java

OutOfMemoryError uploading large file from API V2 - Java

developersSave
Helpful | Level 6
Go to solution

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!

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

To upload large files, you should use the "upload sessions" functionality instead. You can find an example of doing so with the Dropbox Java SDK here.

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

To upload large files, you should use the "upload sessions" functionality instead. You can find an example of doing so with the Dropbox Java SDK here.

developersSave
Helpful | Level 6
Go to solution

thank you, have a nice day!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    developersSave Helpful | Level 6
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?