Move uploading code to non-view controller

If app is launched in background, viewDidLoad will not be run, so this code was broken.

Change-Id: I82a059d8df68005fbeb2177ecd5b33d575f37b44