2

I have made a front end form for Craft CMS 3, using the Guest Entries plugin, to allow visitors to submit images (and some additional info) to the website. Works fine, also for multiple files. I now want to also save some fields to the uploaded assets (the fields are already added to the asset type in Craft). For example let the user pick a category and input a custom title (to ease the burden for the moderator, as there's a lot of images to categorize).

As of now, I am submitting the form with this input field:

<input type="file" name="fields[fieldname][]" accept="image/*" id="fields-fieldname-1" multiple="">

Multiple assets/images are now submitted to this field in a new entry. Ideally, I would like to use the same method, but with some additional values for each asset. I tried making a text field with a name like "fields[fieldname][additonalFieldName]" etc. but nothing seems to work.

My guess is I have to make some custom plugin controller to do this, somehow. So my question is: Is there some other (simpler) way to to this, or if not, how to start making the controller? Most similar controller examples I find through google are for craft2, not craft3.

Thomas L.G
  • 81
  • 5

0 Answers0