finish the basic upload function