Refactored out http upload method.