[BUGFIX] Correctly treat uploaded file when replacing a file