Yii2 delete file from folder
<p>public function actionDelete($id)</p>

<p>{</p>

<pre><code>    $model=$this-&gt;findModel($id);         
    unlink($_SERVER["DOCUMENT_ROOT"]."/../../uploads/".$model-&gt;image);       
</code></pre>

<p>OR</p>

<pre><code>    unlink(dirname(__FILE__).'/../../uploads/'.$model-&gt;image);
    $this-&gt;findModel($id)-&gt;delete();    
    return $this-&gt;redirect(['index']);       
}                                       
</code></pre>