Fix exception when uploading an already-existing file.