upload refactor complete with reflection