hi all,

does anyone know to properly download an excel file?
in my code i have

public function executeDownload(sfWebRequest $request)
        {
                $excel_file = Doctrine::getTable('Project')->find($request-
>getParameter('id'));

                $this->setLayout(false);
                sfConfig::set('sf_web_debug', false);

                $excelpath =
sfConfig::get('sf_upload_dir').DIRECTORY_SEPARATOR.'project'.DIRECTORY_SEPARATOR.
$excel_file['file'];

                // check if the file exists
                $this->forward404Unless(file_exists($excelpath));

                $response = $this->getContext()->getResponse();
                $response->setHttpHeader('Pragma', '');
                $response->setHttpHeader('Cache-Control', '');
                $response->setHttpHeader('Content-Type', 'application/
vnd.openxmlformats-officedocument.spreadsheetml.sheet');
                $response->setHttpHeader('Content-Disposition', 'attachment;
filename="invoice.xlsx"');
                $response->setContent($excel_file);


                return sfView::NONE;

        }

this downloads a file with the name invoice.xlsx but its corrupted.

any help please? Thanks

 the post is here as well

http://forum.symfony-project.org/viewtopic.php?f=22&t=35430

to clear any duplication

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to