Move the deferral object to the upload image function