upload fit function