create new version if the same file is uploaded again over the web interface

If a existing file is uploaded over the web interface again it will stored with a unique name first. Only after the user decided to replace the existing file it gets renamed from the unique name to the name of the existing file. This means that the rename hook needs to handle this situation. Also discussed in #2205