created upload function. fixed #4