implement update_action and change the context menu's upload to update

This function tries to handle all three cases, and is over-complicated:

1. the user tries to upload a file, and the file name does not conflict with any existing file
2. the user tries to upload a file, but the file name conflicts with some existing file
3. the user tries to update a file

We reuse `FileUploadTask` for both upload and update requests, this is the reason of the `if .. else if .. else..`, which make the code hard to read. Can we have a new class `FileUpdateTask` to be a subclass of `FileUploadTask`?