GRAV 1.7 page blueprint pagemedia vs file

Hey guys,

I’m updating a GRAV website right now to 1.7 and stumbled upon a problem with uploading images via admin.

Our page blueprint looks something like this:

          type: file
          label: Bild hochladen
          destination: 'page@:/media'
          multiple: false
          avoid_overwriting: true
            - 'image/*'
            - 'video/*'
            - '.pdf'

          label: Bild auswählen
          type: filepicker
          folder: 'page@:/media'
          preview_images: true

So we used the file field to upload images through admin and save those images in a folder called media and select the uploaded images by using type: filepicker

But with 1.7 type: file does not work anymore with page blueprints and the documentation recommends to use type: pagemedia Reference: Blueprint Form Fields | Grav Documentation

Is this by any means possible to upload images in GRAV 1.7 via admin and store them in a specific page folder?

btw type: pagemedia is not documented at all…

Thanks! :slight_smile:

Ok figured out type: file still works when changing: destination: page@:/media' to destination: 'user/pages/media'

But anyway… if it’s wrong to use type: file for pages what the right way to use type: pagemedia when defining a destination where to save the uploaded files?

@seb3000, Shouldn’t it be destination: 'page://media'?

See definition of File field and streams.

When I add the following to Quarks ‘/blueprints/default.yaml’, an image is correctly added to folder ‘user/pages/media’:

  type: file
  label: Custom Logo Login Screen
  destination: 'page://media'
    - image/*

1 Like

Thank you for answering !

Super strange… I tried this yesterday and got an error while the image was uploaded. Tried it today after reading your post and it works…?

Anyhow… so now we got the type: file upload field working again which - regarding to the docs - you should not use for page blueprints. So what’s the best practice for my use case?