refactor upload file