A good time of day is a question such as linking an image to an article from a form.
I used the standard method yii2;
ImageFile field; in the database, in the same table, created the imageFile field;
I have the following in the controller
if ($model->load(Yii::$app->request->post()) && $model->save()) { $model->imageFile = UploadedFile::getInstance($model, 'imageFile'); if ($model->imageFile) { $model->upload(); } return $this->redirect(['view', 'id' => $model->id]); Loading method - standard
public function upload() { if ($this->validate()) { $this->imageFile->saveAs('uploads/' . $this->imageFile->baseName . '.' . $this->imageFile->extension); return true; } else { return false; } } Images from the form are perfectly loaded, but when I see what comes in the post, in the field imageFile sting 0
and I need to bind the image in the database that was loaded. Please tell me how to do this, or where to read, see.