use write mode instead of append mode when uploading a file

When performing an upload one probably expects the new file to replace the old file instead of appending to it.