I have had a search around the forum but couldn’t find anything to address my issue specifically so here goes!
I have a files field, where the editor can add files. I also have some files stored in the content folder for the page.
Currently, if an editor tries to upload a file using the files field, that has the same filename as one already in the content folder, I get the following error message:
A file with the name “example.pdf” already exists
Which is what I would expect. What I want to happen is to append a string to any filename that is uploaded using the files field (in this case
-document), to avoid this error.
I have tried using
file.create:before to do this, but I think this is still running too late as I am still getting the error.
Is what I am trying to do possible?