Replace Uploaded File

Hello,

I have 1 file limit and when uploading a file a second time, I want it to replace the current file. Is this possible?

I have tried calling cancelAll inside onBeforeFileAdded but I still get an error about the file upload limit.

Thank you.