Custom field data not saving/updating for file upload

Hello,

I have added custom field to upload file in topic. I want to upload file on create topic/save edit button clicked. file is getting uploaded successfully using /uploads.json api but somehow I am not able to update the data into database.

I have used below code:

api.modifyClass(“service:composer”, {>
save() {
const model = this.get(‘model’);
if (model.action === ‘createTopic’ || (model.action === ‘edit’)) {
const fileInput = document.getElementById(‘fileUpload’);

                    const file = fileInput.files[0];

                    if (file) {
                        uploadImage(file).then(url => {
                            // Set the custom field value
                            model.set('topic_file_upload', url);

                            this._super(...arguments);
                        }).catch(error => {
                            console.log('error', error);
                        });
                    }
                }
            },
        });

What am I missing here? can anyone help me?

Thanks!