Leveraging Core Functionality in Icon Upload Plugin [closed]

Firstly you can upload the image using wp_media_handle as it returns attachment id.

Then try to add your desired metafields by passing the same id in each of them.