Upload multiples files to an entry after its creation (and how to add a caption ?)

Hmm, I couldn’t get it working. I didn’t really need it to work but was testing something out.

Can I ask you something slightly different? When I’m uploading images, I do it with a custom controller while the entry is created. The code you have above is after the entry is created and you reference it with the refId. Should I be doing this also? The reason I ask is when I delete an entry the images accciated are not being deleted from the media library.

const entity = await strapi.service("api::listing.listing").create({
      data: {
        contact_firstname: listing.contact_firstname,
        contact_lastname: listing.contact_lastname,
        contact_phone: listing.contact_phone,
        contact_email: listing.contact_email,
        contact_city: listing.contact_city,
        contact_state: listing.contact_state,
        title: listing.title,
        price: listing.price,
        description: listing.description,
        category: listing.category,
        featured: listing.featured,
        publishedAt: listing.publishedAt,
        session_id: session.id,
      },
      files,
    });