Upload error handling

Added exception catching for upload button click and added more
commenting and documentation.