My Model code,
public function rules()
{
return [
[['image'], 'safe'],
['image', 'file', 'types'=>'jpg, gif, png'],
];
}
Use Apartfrom types,validation message not display document save in database
My Model code,
public function rules()
{
return [
[['image'], 'safe'],
['image', 'file', 'types'=>'jpg, gif, png'],
];
}
Use Apartfrom types,validation message not display document save in database
Copyright © 2021 Jogjafile Inc.
To validate file type you should use property
$extensions
of FileValidator.Update
Ok, I've got this. Please check one more time the source link, especially the controller section. To validate your model, you have to use
validate()
function.Example code:
Source.