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
6 years ago

Java Api upload same file rename not working

Hello everybody,
from 12.30 on 10/15/2019 the Dropbox Api java does not force the renaming of the existing files.
Load the file xyz.pdf and dropbox, correctly, assigns me the id <id: xxx> but when I re-upload the same file xyz.pdf the rename does not work:
I expected the file to be renamed to xyz (1).pdf and the id returned <id: zzz>

I use dbxClient V2

below part of the code with which I impose the rename
UploadBuilder fileUploader = dropboxClient.files (). UploadBuilder (pathFileName);
fileUploader.withMode (WriteMode.ADD) .withMute (Boolean.TRUE) .withAutorename (Boolean.TRUE);

is there any news about it

thanks

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    Apologies for the very late reply. Our forum software did not notify me of this post unfortunately.

     

    Anyway, in this case were you uploading the same exact file content? Even with WriteMode.ADD, if you just upload the same exact file content that is already uploaded at that path, it won't add another copy. You can find more information in the WriteMode documentation. Here's the relevant part in this case:

    If the target path refers to a file with identical contents, nothing gets written; no conflict.

    Edit: For reference, you can force a conflict when the contents are identical using UploadBuilder.withStrictConflict(true).

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,894 PostsLatest Activity: 2 hours ago
328 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!