Textarea image management

I don’t fully understand the textarea file upload and select business. The default behavior of uploading the file to the current page without having the ability to delete them is a no go so I need to be able to manage them. It appears to be possible but I’m not quite sure. So I have a textarea with a file button and it all works, but I have no ability to manage the files (as expected). So do I create a ‘files’ section or do I create a ‘files’ field where these files can be uploaded to and selected from?

Can you good folks provide some insight and perhaps an example of what that bit of the blueprint might look like?

1 Like

I figured out that the textarea file select can reference a files section on the current page or any other page, not a files field. And you can target specific files via the file template they use.

If you want to select from and upload to a files section on the current page that bit of blueprint might look like the following.

text: 
  type: textarea
  files: page.myimages.template('mytemplate')
  uploads: mytemplate

In the example above ‘myimages’ is the name of the files section. ‘mytemplate’ is the template assigned to the files.

It’s not required to include .template('mytemplate') on the files line, but that just targets files that use the ‘mytemplate’ file template.

If you don’t include the uploads: mytemplate it will not upload to your files section.

So setting a file template is required if you want the textarea upload to upload somewhere specific. Please correct me if I’m wrong.

No, you can’t reference a files section, you can use a query to select the files using the files attribute, but there is no method to query a section. You get a result with your query, yes, but only because Kirby falls back to the pages`s images if the query doesn’t have result.

But it is true, you need an additional files section that displays the images you upload via a textarea field to then be able to delete them or add meta data to those files.

The behaviour is a bit different from the files field, because the files field has a link to the image, so that you can open it in the file view and manage it there.

1 Like

I created an ideas issue here:

Upvote if you want it.