More than 1 file upload with same filename

PHPMaker v2023.13I have a table with 2 fields storing filename for uploading images.In my \uploads\ folder, I already have the following files:
background.png
background(1).png
background(2).png
.
.
background(99).pngI added a new record and added 2 different files in the 2 fields. (NOTE: Both file are the same name, which is background.png from different folder in my drive).When I save, both fields are saved with the same filename, which is background(100).png.I checked in the \uploads folder, only the 2nd file is saved and it renamed as background(100).png, which is the next sequence number.

That’s the normal logic for handling files with the same file name. It automatically add the index to avoid conflict filename.You may actually rename the filename by yourself, that suits to your own logic, for example: How to rename multiple files and displayed it vertically (v2022).

Ya I understand that automatically add the index to avoid conflict filename.But the issue here is I have 2 columns. Column1 I upload background.png from one of my folder. Column2 I upload also background.png but it’s from another folder. There is a reason I can’t rename it manually before I upload. So in this case, should it automatically rename the first file as background(100).png and 2nd file in another column as background(101).png instead of renaming both the same name and the first file is now missing.It it’s by design we can’t upload same filename (which is totally 2 different files), then I will try your example by renaming it myself.

Note that the file names are renamed per field during upload. (They will not be compared between fields.) If both fields use the same upload folder, the images will be stored to the same folder, overwriting each other. In your case you better compare the file names yourself and rename one of them if they are the same, or you may use different upload sub-folder for different fields.