i got this error in inspect element under console
Not allowed to load local resource: file:///C:/xampp/htdocs/Yii2System/backend/web/data/cust_images/user_1.jpg
in view file:
<div class="col-md-12 text-center">
<?= Html::img($info->getUserPhoto($info->user_photo), ['alt'=>'No Image', 'class'=>'img-circle']); ?>
</div>
in controller:
public function actionUserPhoto($uid)
{
$model = $this->findModel($uid);
$info = UserInfo::findOne($model->user_info_id);
$info->scenario = 'photo-upload';
$old_photo = $info->user_photo;
if($info->load(Yii::$app->request->post()))
{
$info->attributes = $_POST['UserInfo'];
$info->user_photo = UploadedFile::getInstance($info,'user_photo');
if($info->validate('user_photo') && !empty($info->user_photo))
{
$ext= substr(strrchr($info->user_photo,'.'),1);
$photo = $old_photo;
$dir1 = Yii::getAlias('@backend').'/web/data/user_images/';
if(file_exists($dir1.$photo) && $photo!='no-photo' && $photo!= NULL) {
unlink($dir1.$photo);
}
if($ext!=null) {
$newfname = $info->user_name.'_'.$info->user_id.'.'.$ext;
$returnResults = $info->user_photo->saveAs(Yii::getAlias('@backend').'/web/data/user_images/'.$info->user_photo = $newfname);
if($returnResults) {
$info->save(false);
}
}
}
return $this->redirect(['view', 'id' => $model->user_id]);
}
return $this->renderAjax('photo_form', ['model' => $model, 'info' => $info, ]);
}
who can help me to fix this problem...