I've noticed in Kohana 3 these error messages provided by default.
return array(
'not_empty' => ':field must not be empty.',
);
Obviously, :field
is replaced with the field name.
Now I am validating an image upload. Obviously, I'm allowing only JPG, JPEG, GIF & PNG.
I have an error message set up like so.
return array(
'photo' => array(
'Upload::type' => 'You must upload an image file (JPG, JPEG, GIF, PNG)'
)
);
I also use Kohana's validation helper like so.
$input->rules('photo', array(
'Upload::type' => array('Upload::type' => array('jpg', 'jpeg', 'png', 'gif'))
));
Is there a way I can use those accepted extensions in my error string, perhaps like...
return array(
'photo' => array(
'Upload::type' => 'You can only upload files of :types'
)
);