How to linked/upload nested and main sub component

Currently working on the same problem, but just managed to have some sort of solution: What you have to do in the custom controller that manages your upload endpoint is this:
await strapi.plugins.upload.services.upload.upload({
data: {
},
ref: “api::xxxxx.xxxx”,
refId: 11,
field: “fichier”,
},
files: {
…ctx.request.files.files,
},
});

with ref, refId, and field being the relevant data to do the linking