I am getting these errors when performing the request
Code
fileData.append(
`files`,
value[i],
`${new Date().getTime()}_${key}_${type[1]}`
);
fileData.append("ref", "order.opc.director");
fileData.append(`refId`, order.opc.director.id);
fileData.append(`field`, 'image');
Error
12|strapi-dev | [2021-06-18T17:27:22.003Z] error TypeError: Cannot read property 'associations' of undefined
If I am trying to follow the docs as suggested here https://strapi.io/documentation/developer-docs/latest/development/plugins/upload.html#upload-file-during-entry-creation
TIP
If you want to upload files for a component, you will have to specify the index of the item you want to add the file to. Example
files.my_component_name[the_index].attribute_name
Is it required to specify index on Single Component ( files.opc[0].director[0].image )
Code
fileData.append(
`files.opc[0].director[0].image`,
value[i],
`${new Date().getTime()}_${key}_${type[1]}`
);
fileData.append("ref", "order.opc.director");
fileData.append(`refId`, order.opc.director.id);
fileData.append(`field`, 'image');
Error
{"statusCode":400,"error":"Bad Request","message":"Bad Request","data":{"errors":[{"id":"Upload.status.empty","message":"Files are empty"}]}}
Please help me on that, I do not understand how I figure this out