Re-factor upload commands to pull out common functions. Add special char replacement and cleanup files tests