Hi there,
I’m trying to upload image in yii2, I’m using Ubuntu 15.10.
Image uploaded to uploads directory but I got this error and data not saved into database.
public function actionCreate()
{
$model = new Post();
$catModel = new Category();
if ($model->load(Yii::$app->request->post())) {
$path = Yii::getAlias('@root') .'/uploads/';
$model->image = \yii\web\UploadedFile::getInstance($model, 'image');
$model->image->saveAs($path . $model->image->baseName . '.' . $model->image->extension);
if($model->save())
return $this->redirect(['view', 'id' => $model->id]);
return $this->render('create', [
'model' => $model,
'catModel' => $catModel
]);
} else {
return $this->render('create', [
'model' => $model,
'catModel' => $catModel
]);
}
}
Error says I have not installed:The fileinfo PHP extension is not installed.
but as my other search fileinfo extension already installed in newer ubuntu versions.
pls see attaced screenshot for full detail, how I can fix this issue?
6944
you can find this question on:Stackoverflow