upload_token func flow