merged the upload photo function