cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you an educator? Well we want to hear from you, so check out some tools we think might help you out 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: 

Overwrite upload

Overwrite upload

蕾雷
Helpful | Level 6

In Dropbox v2 sdk, the need to cover the replacement of existing documents, how to achieve? Similar to V1's ChunkedUploader.finish (path, parentRev). I use the UploadSessionFinishUploader.uploadAndFinish upload mode, can give me some help?

Thank you!

2 Replies 2

Re: Overwrite upload

Greg-DB
Dropboxer

When you call uploadSessionFinish (to get your UploadSessionFinishUploader), you supply a CommitInfo instance as the commit parameter. That CommitInfo instance should have a mode (a WriteMode) which determines how the file is written. The equivalent to API v1's "parentRev" is to use the update mode where the value is the rev of the parent.

 

So, that would look something like this:

 

WriteMode mode = WriteMode.update(parentRev);
CommitInfo commit = CommitInfo.newBuilder(dropboxFilePath).withMode(mode).build();

client.files().uploadSessionFinish(cursor, commit).uploadAndFinish(in);

Re: Overwrite upload

蕾雷
Helpful | Level 6

 

thank you very much!

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    蕾雷 Helpful | Level 6
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?