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

This line to the end of this function is shared between `uploadFile` and `updateFile`, can we refactor and share it?