implement the register function and change the image upload function