RE: Attachments in Business Central
While dealing with files, technically it becomes tricky to conclude that Same Name = Same Content, because of which not just BC but several other ERP systems are now revamping their file storing logic. If you take a look at the file storing logic of your PC, if you store 2 files with the name "Test File" the second file automatically adapts the name "Test File - Copy". So what you're experiencing with BC today, has been a standard feature in all Operating Systems since ages
If you/your customer does not want this behavior in BC, you can write a AL Code Extension, which triggers when the file upload button/action is undertaken from the UI. If the file that is incoming has a exact same name in comparison to the file which is already uploaded, you can give an option to the user to either overwrite existing or terminate operation to avoid duplication
1. If you present an option to the user to be able to overwrite, your AL logic should first delete the existing file and then upload the new one which is incoming. To uphold data integrity, you can only allow overwrite (delete existing & insert new) if the earlier file was also uploaded by the same user uploading the new file
2. However looking at the second option, if you don't allow the user to store a second file with the same name, he/she may try to bypass that by manually changing the file name, as simply as introducing a space in the name somewhere in the name
You would need customization to enable this, which is clear as of now. You may find a handful of blogs, which you can merge together and create your AL code but customizing for files in BC can go really ugly - real fast if not taken care of. It may even end up slowing down the whole operation, so ensure that the time you'll be investing doesn't end up driving you down a rabbit hole