Skip to main content
Question

API allows for duplicate file names in the same folder

  • May 22, 2025
  • 1 reply
  • 24 views

Forum|alt.badge.img

Using the API via the python SDK, when I upload the same file (name) multiple times to the same folder, a new file object gets created every time.

I was expecting the previous file to be overwritten, or the request to fail (the API doc says that upload will "Returns an error if the file already exists, or the account has run out of disk space.") like for the folder creation.

I was wondering what is the expected behavior when multiple files with the same name are uploaded to the same folder ?

1 reply

Forum|alt.badge.img

I think you want to use the update version api rather than the new file endpoint. Here's a link to that sample code!

https://github.com/box/box-python-sdk/blob/main/docs/usage/files.md#upload-a-new-version-of-a-file