pick the scale function out of the upload function