Check file type (JPG, PNG, GIF)

I like to check if the uploaded file is for example an .GIF.
I tried the following but it’s not working. Any suggestions?

<?php if($file->type() === 'image/gif'): ?><?php endif ?>

$file->type() returns the “type” in Kirby’s terminology: something like “image”, “document” or “archive”, etc.

You probably wanted to use $file->mime() === 'image/gif' or $file->extension() === 'gif'

Relevant docs:

1 Like

Thanks a lot :raised_hands:

1 Like