upload function required in both background and options