refactor(XHR upload handlers): #897 - move common API methods into a common file/module