updated upload class to dynamically check environment