Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // application/controllers/GetController.php
- class GetController extends Zend_Controller_Action {
- public function indexAction() {
- $form = new Default_Form_Download();
- if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) {
- $this->view->msg = 'Congratulations!';
- $file = APPLICATION_PATH . '/files/Setup.exe';
- $this->getResponse()
- ->setHeader('Pragma: public')
- ->setHeader('Expires: 0')
- ->setHeader('Cache-Control: must-revalidate, post-check=0, pre-check=0')
- ->setHeader('Content-Type: application/force-download')
- ->setHeader('Content-Type: application/octet-stream')
- ->setHeader('Content-Type: application/download')
- ->setHeader('Content-Disposition: attachment; filename="Setup.exe"')
- ->setHeader('Content-Description: File Transfer')
- ->setHeader('Content-Length: ' . filesize($file));
- // If using Zend_Layout, we need to disable it:
- $this->_helper->layout->disableLayout();
- // Disable ViewRenderer:
- $this->_helper->viewRenderer->setNoRender(true);
- } else {
- $this->_helper->Redirector->gotoUrl('/');
- }
- }
- }
Add Comment
Please, Sign In to add comment