Duplicate and modify local file (e.g. via File System Access API?)

Background: An XML file is to be loaded into a web app. Various parameters are changed there. The file is then downloaded again. Depending on the browser settings, the modified XML file is either saved in the download folder or the ‘save as/browse directories’ window opens.

Issue: These XML files can be in different local folders and while you are making the modifications in the webapp, it can happen that you are also uploading files from other folders or downloading them to other folders on another platform. This results in having to constantly browse the local file system in the ‘save as/browse directories’ window or copying files from the standard download folder, and wasting a lot of time.

Ideal case: The file is automatically downloaded to the original source folder, is named the same but contains the suffix “_mod” or similar.

My research: I came across the File System Access API, which allows reading and writing of local files and folder structures. The API also works on the browsers used for my purposes. However, it seems that the user still has to specify a directory in order to create a new file. Or you can overwrite the original file, which would be suboptimal for my purposes. So my question: Is there any way to easily duplicate a file and customize its content (it doesn’t have to be via File System Access API, maybe there are other JS or PHP solutions)? Best solution that has emerged so far would be if the user selects a file and straight after that the folder where it is located. I haven’t yet tried whether this really works, as I don’t think it makes sense or feels intuitive.

Thank you very much for your suggestions.