File Directory in Yii2 Advanced

I want to locate a file from this project yii2advanced/data/import_files/state_sample_files/state_import_en.xlsx

as shown below:



I used this

    public function actionDownloadFile($id)


    	$path = null;


    	if($id=='SSF') {

    			$path = Yii::getAlias('@webroot').'/data/import_files/state_sample_files/state_import_en.xlsx';


		if(file_exists($path)) {

			return \Yii::$app->response->sendFile($path);



			throw new NotFoundHttpException('The requested file does not exist.');	


but it was showing file not found. But when I used var_dump, I saw that it was going inside backend folder.

How do I resolve this.

Hi folumike,

Just check what $path has.