complete the function of uploading image