refactor upload to use new api.