I am trying to send a file to the browser in a Zend Framework PHP application. I found an action helper here - https://github.com/noginn/noginn/blob/master/Noginn/Controller/Action/Helper/SendFile.php
In my controller I have an action like this
public function downloadfileAction()
{
//get the file name and strip out all white spaces
$title = preg_replace('/\s+/', '', $this->getRequest()->getParam('title'));
//create the file path
$path = 'downloads/'.$title.'.pdf';
//call the action helper to send the file to the browser
$this->_helper->SendFile->sendFile($path, 'application/x-pdf');
}
my file is located in my public folder ie MyApp/public/downloads/myFile.pdf
When I run the action, I get a view file not found error and the download is not started.
exception 'Zend_View_Exception' with message 'script 'myController/downloadfile.phtml' not found ...
Can anyone suggest what I am doing wrong?