Hello, I have problem with download image from server.
My view
echo Html::a('<span class=" glyphicon glyphicon-save-file"></span>', ['image/download-file', 'id'=>$model->id_image,],['title'=>'pobierz','data-pjax'=>"0"]);
and controller
public function actionDownloadFile($id=null)
{
$download = image::findOne($id);
$path = Yii::getAlias('@webroot').'/uploads/'.$download->src;
if (file_exists($path)) {
return Yii::$app->response->sendFile($path);
}
}
If I try download other format than image, e.g pptx,docx etc I can do it, but if tried png/jpg I can’t. I gets white page… where is error?