Skip to content

How to add File upload in the Gift Message form

I am trying to Add image upload in the Gift Message. To achieve , created a Field: image_url in the Table: gift message using db_schema.xml and used the extension_attributes.xml to set and retrieve the value.

I have added the file upload element in the gift-message-form.html. But unable to pass the uploading file information to gift Message API model (Because gift message using /carts/mine/gift-message API).

Can anyone explain with an example how to upload the file using the controller with Ajax and store the uploaded file name in the Gift message table along with this record.

Thanks in Advance