Difference between Add & Select

Hello,
What is the difference between these two “files” views ?

rsz_1fields

they appear to have the same syntax in the blueprint file, I miss something?

fields:
  image:
    label: Cover
    type: files
    layout: cards
    info: "{{ file.dimensions }}"
    template: image

The one on the left is a files section. A files section is used to upload files to a page folder.

The one on the right is a files field. It allows you to select files that have already been uploaded. The selected file (the filename or file URI) is stored in the content file.

Thanks @texnixe,
but at moment I’m trying to use the first one (file section) for both, and in different blueprint with the same code, I’m getting these different behaviours…
Am I doing errors or forgetting somethings?

Without seeing what you have in your blueprints, this is a black box to me. Please post both blueprints, then I can tell you.

So weird behaviour:

/blueprints/pages/slide.yml

title: Slide
num: date
icon: camera

status:
  draft:
    label: Draft
    text: The note is still in draft mode
  unlisted:
    label: In Review
    text: The note is online
  listed:
    label: Published
    text: The note is online and listed in the blog

columns:
  - width: 2/3
    fields:
      text:
        label: Caption
        size: large
      showcaption:
        label: Show Caption
        type: toggle
        text:  
        width: 1/3
        size: large
      direction:
        label: Direction
        type: select
        width: 1/3
        options:
          transparent: NONE
          left:    Left
          center:  Center
          right:   Right    
      captioncolor:
        label: Caption Color
        type: select
        width: 1/3
        options:
          green:    Green
          yellow:   Yellow
          orange:   Orange    
          red:      Red
          blue:     Blue
          pink:     Pink
          lightblue: Light Blue
          aqua:     Aqua
          white:    White 
          grey:     Grey
          brown:    Brown
          black:    Black
      backgroundcolor:
        label: Background Color
        type: select
        width: 1/3
        options:
          black:    Black
          white:    White
          transparent: Trasparent          
  - width: 1/3
    sections:
      meta:
        type: fields
        fields:
          date:
            type: date
            time: true
            default: now
          #tags: true
      itemimage:
        label: Cover
        type: files
        layout: cards
        info: "{{ file.dimensions }}"
        template: image
        max: 1

and

/blueprints/pages/article.yml

title: Article
num: date
icon: 📖

status:
  draft:
    label: Draft
    text: The note is still in draft mode
  unlisted:
    label: In Review
    text: The note is online
  listed:
    label: Published
    text: The note is online and listed in the blog

columns:
  - width: 2/3
    fields:
      text:
        type: textarea
        size: large
  - width: 1/3
    sections:
      meta:
        type: fields
        fields:
          date:
            type: date
            time: true
            default: now
          author:
            type: users
          tags: true
          files:
            type: files
          gallery:
            type: pages
            query: site.find("photography").children
            multiple: false
            info: "{{ page.images.count }} image(s)"
            empty: "No gallery selected"
            image:
              cover: true
            help: Place the {{ gallery }} tag anywhere
		itemimage:
			label: Image
			type: files
			layout: cards
			info: "{{ file.dimensions }}"
			template: image
			max: 1

In your article.yml you have a files field called files in the meta fields section (I’d rename that one because it will otherwise conflict with Kirby’s files() page method).

Then at the end of that same article.yml blueprint, you have a files section called itemimage, but your indentation is wrong, it should be on the same level as the meta section. So this section shouldn’t even show up in your blueprint.

In your slides.yml you have a files section called itemimage.

Thank you so much
I’ve fixed my article.yml (indent issue was a copy/paste mistake)

title: Article
num: date
icon: 📖

status:
  draft:
    label: Draft
    text: The note is still in draft mode. It can only be seen by editors with panel access.
  unlisted:
    label: In Review
    text: The note is online and can be visited with the direct URL. The team must still give the final go to publish it.
  listed:
    label: Published
    text: The note is online and listed in the blog

columns:
  - width: 2/3
    fields:
      text:
        type: textarea
        size: large
  - width: 1/3
    sections:
      meta:
        type: fields
        fields:
          date:
            type: date
            time: true
            default: now
          author:
            type: users
          tags: true
          gallery:
            type: pages
            query: site.find("photography").children
            multiple: false
            info: "{{ page.images.count }} image(s)"
            empty: "No gallery selected"
            image:
              cover: true
            help: Place the {{ gallery }} tag anywhere in your text to add the selected gallery
          itemimage:
            label: Image
            type: files
            layout: cards
            info: "{{ file.dimensions }}"
            template: image
            max: 1

But the issue still remain

fields

Can we consider a possible interference with the “Gallery” field?

EDIT: Also removing Gallery field the issue remains

Now you have indented your itemimage thingy even more, so it becomes a field (it is now exactly underneath the gallery field. As I said above, your indentation must be the same as the metasection to make it a new section

sections:
      # meta section
      meta:
        type: fields
        fields:
          date:
            type: date
            time: true
            default: now
          author:
            type: users
          tags: true
          files:
            type: files
          gallery:
            type: pages
            query: site.find("photography").children
            multiple: false
            info: "{{ page.images.count }} image(s)"
            empty: "No gallery selected"
            image:
              cover: true
            help: Place the {{ gallery }} tag anywhere
       
      # itemimage section
      itemimage:
        label: Image
        type: files
        layout: cards
        info: "{{ file.dimensions }}"
        template: image
        max: 1

You have to really mind the indentations. Do you use a proper editor that shows you indentation helplines?

1 Like

Thank you @texnixe!!
You’ve solved my issue! Was caused by wrong indentation ! I’m using brackets but I thought really the indentation under field section was right,
hence the the correct way is indent in line by meta .
Good to know thank you so much