Restrict a files field to uploading image only (jpg/png)

I’ve got a files field in a tab in the site.yml blueprint where the user can upload an image to be used as their logo. I’d like to be able to limit them to only upload an image file (jpg or png), but as far as I can see this isn’t possible.

Here’s my code:

logo:
  label: Logo
  type: files
  layout: cards
  multiple: false
  query: site.images

This does work in that it allows the user to select just one image from the site images, but it doesn’t stop them uploading other file types such as PDF, mp3 etc.

Is there any way to achieve this?

Thanks :slight_smile:
Simon

You can use the accept option in file blueprints for this. Take a look here…

2 Likes

Thanks @jimbobrjames, all working great now!