added exception handling for upload file