FIX: broken query if upload id is missing (PR #9900)

Log warnings if there are any errors trying to upload group flair image and ensure upload.id exists before trying to use it in a sql query.

GitHub