While uploading files in yii2 I am facing an issue of saveAs() as a null. Please see the code below.
if (Yii::$app->request->post()['flag'] == 4){
$model->photo= UploadedFile::getInstance($model,'photo')
$model->photo->saveAs('uploads/'.$model->photo->baseName.'.'.$model->photo->extension);
$model->save(false);
}
Please give the specific ans as I have used the library of UploadedFile and everything.
and when it stored in db it store as the c://fakepath/name.txt