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

jijik's avatar
jijik
New member | Level 2
4 years ago

Upload API - skip upload, when file with the same content already uploaded

Dropbox windows app is smart and when currently uploading file already exists somewhere in dropbox (file with the same content hash I guess), it doesn't fully upload it again. It gets marked as uploaded almost immediately. Is it possible to achieve such optimization via the Dropbox Upload API? I use UploadSessionStartAsync APi, but it always fully upload any file even if the file already exists in neighbor directory.

Thank you

  • The Dropbox API doesn't offer a way to do this automatically, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

     

    You could effectively reproduce this behavior though, at least within an account. To do, you'd need to do something like this:

    • Use /2/files/list_folder[/continue] to list the metadata for the contents of the account, which includes the 'content_hash' for each file. (You can cache this and update it over time as needed.)
    • Before starting an upload of a file, compute the content hash of the local data.
    • Check if that local content hash exists in the account already, by looking for it in the metadata retrieved in the first step.
    • If the content_hash is found in the existing metadata, use /2/files/copy_v2 to copy the existing file to the new path instead of uploading it again. If it is not found, proceed to upload it normally (e.g., using UploadSessionStartAsync, etc.).
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    The Dropbox API doesn't offer a way to do this automatically, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

     

    You could effectively reproduce this behavior though, at least within an account. To do, you'd need to do something like this:

    • Use /2/files/list_folder[/continue] to list the metadata for the contents of the account, which includes the 'content_hash' for each file. (You can cache this and update it over time as needed.)
    • Before starting an upload of a file, compute the content hash of the local data.
    • Check if that local content hash exists in the account already, by looking for it in the metadata retrieved in the first step.
    • If the content_hash is found in the existing metadata, use /2/files/copy_v2 to copy the existing file to the new path instead of uploading it again. If it is not found, proceed to upload it normally (e.g., using UploadSessionStartAsync, etc.).

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

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