Extracted function AddPhoto from UploadImage handler