Black Friday 2022 Offers 30% discount in SymfonyInsight yearly business plan (offer ends in 3 days)


Edit this page

Warning: You are browsing the documentation for Symfony 2.0, which is no longer maintained.

Read the updated version of this page for Symfony 6.1 (the current stable version).


The Image constraint works exactly like the File constraint, except that its mimeTypes and `mimeTypesMessage` options are automatically setup to work for image files specifically.

See the File constraint for the bulk of the documentation on this constraint.


This constraint shares all of its options with the File constraint. It does, however, modify two of the default option values:


type: array or string default: an array of jpg, gif and png image mime types

You can find a list of existing image mime types on the IANA website


type: string default: This file is not a valid image

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.