We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Download files phalcon

$filename=$this->dispatcher->getParam(0);

$extension = pathinfo($filename, PATHINFO_EXTENSION);

$outFile = DIR_PUBLIC.'attachments/'.$filename;

$this->output_file($outFile, basename($filename), $extension);

i get file name and path file but download notworking How to download this files.

I send a redirect response to the file, like

$this->response->redirect($outFile);

I also found a post in this forum you can refer to: https://forum.phalcon.io/discussion/196/file-downloads