Fix the file exists check when uploading.

Replacing and moving itself is still error prone. The
uploading needs refactoring to fix these, and made
usable by third party modules and plugins.

git-svn-id: http://textpattern.googlecode.com/svn/development/4.x@5323 2fea6a4d-a838-0410-917b-93a53c48e9d2