Set a template for a file (images) blueprint

I have created a blueprint for files (work.yml), in my case for images:

title: Imagen de una obra

accept:
  mime: image/jpeg, image/png

fields:
  description:
    label: Título de la imágen
    type: text

And after that, I went to the work blueprint to change the template for that files but for some strange reason it not works:

    sections:
      fields:
        type: fields
        fields:
          mainimage:
            label: Imágen de portada
            type: files
            template: work
            width: 1/2
            max: 1
            layout: cards
            image: 
              cover: true
              ratio: 3/2

What’s wrong? Thanks,

The files field does not have a template property.

If you want to set the file’s template when uploading it through the field, you have to use the uploads property:

          mainimage:
            label: Imágen de portada
            type: files
            # template: work 
            uploads: work # <---
            width: 1/2
            max: 1
            layout: cards
            image: 
              cover: true
              ratio: 3/2

If you also want to restrict the selection in the file picker to work files, you also have to query for them:

          mainimage:
            label: Imágen de portada
            type: files
            uploads: work
            query: page.files.template('work') # <---
            width: 1/2
            max: 1
            layout: cards
            image: 
              cover: true
              ratio: 3/2

The video-guided on Youtube confused me. I think that @bastianallgeier speaks about template in the following minute:

Thanks,

I think the confusion stems from him speaking about files sections (which have a template property). I don’t know why it’s called “uploads” in files fields, this tripped me up too in the past.
I would kind of expect a template property in fields to both preset the query option as well as the uploads option… Maybe in a future release :slight_smile: