i have a code like this :
public function downloadFile($name)
{
$storagePath = "/opt/tmp/";
// check filename for allowed chars (do not allow ../ to avoid security issue: downloading arbitrary files)
if (!is_file("$storagePath/$name")) {
throw new \yii\web\NotFoundHttpException('The file does not exists.');
}
return Yii::$app->response->sendFile("$storagePath/$name", $name);
}
this code is successfully download file
, but that's can't direct to certain page.
So i want, if i press button
click,
in browser
is save file, in web
is direct to certain page.
Is it possible?