I have a collection in that there is an array of component product_licenses which take data along with image. if I upload an image to the Lis tag it works. but when I try to upload to the first element of the array using the license tag it fails since it is inside.
const entity = await strapi.services[
'product-registration'
].create(input);
if (lis) {
// automatically uploads the files based on the entry and the model
// eslint-disable-next-line max-len
await strapi.plugins.upload.services.upload.uploadToEntity({
id: entity.id || entity._id,
model: 'product-registration',
field: 'lis'
}, lis);
await strapi.plugins.upload.services.upload.uploadToEntity({
id: entity.id || entity._id,
model: 'product-registration',
field: 'product_licenses[0].license'
}, lis);
}
Is there any way I can achive this?
In order to link the uploaded image to a component field, you should set the params argument as follows: