Applying a template to a Files Field

Hi there,

I’m trying to assign a blueprint to my Files field.

My blueprint looks like this:

width: 2/2
      fields:
        featuredartistsslotone:
          label: Featured Artists Slot 1
          type: toggle
          width: 1/6
        featuredartistsslottwo:
          label: Featured Artists Slot 2
          type: toggle
          width: 1/6
        featured:
          type: files
          min: 0
          max: 6
          layout: cards
          label: Featured Artwork
          multiple: true
          uploads: artist

I have an artist.yml in my files directory but when I visit one of the uploaded files I get the following error message…

This page has no blueprint setup yet

Can someone explain why this is? Is it possible to assign fields to files in this way?

Yes, that is possible. Maybe you have an error in your files blueprint? Or have you uploaded files prior to assigning the blueprint?

I’d uploaded prior to assigning the template. Removing all image from the page’s folder fixed the problem.

Thanks!

The template is always only assigned at file upload, never afterwards. The same is true for sections.

If you upload a lot of files and want to assign a template in hindsight, you can programmatically update the meta files ($file->update()).

1 Like