A strange problem occurs when uploads with fileinput encounter the same file name

I used fileinput to upload images to retool storage, and when I uploaded two images with the same file name but different contents, it was correct after execution. When I enter the retool storage, I find that the content is overwritten but the file name is not overwritten. I did not check overwrite existing file with same name in the Settings. Please see the screenshot, thank you!


Hi @fei2024 :wave:

Retool Storage doesn't allow multiple files with the same name. By default if you upload multiple files with the same name the first will be the original name and the subsequent files with be the file name with (n) regardless of the contents.

For example, if I upload the same image 4 times with the name cat.jpg and then 1 different image with the name cat.jpg, I'll see the following.

However, if I were to enable Overwrite existing files with the same name then regardless of the contents there would only be one file named cat.jpg, which is always overwritten by the last photo uploaded with that name.

Let me know if that clear things up for you!

  Thank you very much for helping me solve the problem.
  This application is to upload product pictures to users, in order to prevent users from having files with the same name, so I do not check "Overwrite existing files with the same name", the file name is normally named as FileName(n).jpg, however, The content was uploaded last. 
now I use my file to illustrate, I now simulate 2 entity files 22.jpg with the same file name but different image, after uploading, the file name will show 22.jpg, 22(1).jpg.
 Look at the file ids and urls for the following two files. They're different, but the image content is the same,It was uploaded last.

22

22(1).jpg
a46ad0a4-39b5-4c56-be24-cd249e590fa7
https://xxx.retool.com/api/file/a46ad0a4-39b5-4c56-be24-cd249e590fa7

22.jpg
c25b30db-eca9-4879-b04f-b6193c64dca6
https://xxx.retool.com/api/file/c25b30db-eca9-4879-b04f-b6193c64dca6

If this problem is not easy to solve, can you customize the name of the file when uploading? How to do that?

Sorry for misunderstanding. I haven't been able to reproduce. Would you mind sending a screen recording of how this happens?