Don't overwrite saved files

If a file with the same name was uploaded the already existing file was
overwritten. We now upload to a temporary file first and then rename it
to the ID in the database after saving the File object in the database.