Adding event handler to the UI and implementing upload