refactor upload