S
S
Svetlana Galenko2018-11-20 21:56:13
Yii
Svetlana Galenko, 2018-11-20 21:56:13

Setting unknown property: yii\validators\FileValidator::0?

Good evening, I'm trying to add news from the site through the admin panel, I click on "Add" and then this flies out:
5bf4580264423114561424.png
Here are the rules:

public function rules()
    {
        return [
            [['name', 'body', 'alt', 'img_small', 'img_big', 'put_date', 'hide'], 'required'],
            [['body', 'alt', 'img_small', 'img_big', 'hide'], 'string'],
            [['img_name'], 'default', 'value' => 0],
            [['put_date'], 'safe'],
            [['name'], 'string', 'max' => 255],
            [['image'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png', 'jpg'],
        ];
    }

And here is the table:
5bf45c4440213290332970.png

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
M
Maxim Timofeev, 2018-11-20
@swallow_97

'extensions' => 'png', 'jpg'],
change
to
'extensions' => ['png', 'jpg']],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question