Why don't you put the MIME Type on the header?
On Sat, Jun 6, 2009 at 1:50 PM, ctrlming <[email protected]> wrote:
>
> Hi, I am coding an action for file download,
> in firefox,chrome,opera,safari this action works and no errors.
> but I got a problem in IE6 & IE7
> in IE6 the file can be downloaded but it has no filename
> in IE7 file can`t be downloaded, it notice " Internet Explorer can`t
> download file from ..."
> and this is my code
>
> $this->setLayout(false);
> $response = $this->getResponse();
> $filePath = sfConfig::get('sf_upload_dir').'/assets/work_2009.doc';
> $fileSize = filesize($filePath);
> $fileName = 'work2009';
> $response->clearHttpHeaders();
> $response->setContentType('application/octet-stream;charset=utf-8');
> $response->setHttpheader('Pragma: public', true);
> $response->setHttpHeader('Content-Description', 'File Transfer',
> true );
> $response->setHttpHeader('Accept-Ranges', 'bytes', TRUE);
> $response->addCacheControlHttpHeader('Cache-control','must-revalidate,
> post-check=0, pre-check=0');
> $response->setHttpHeader('Content-Transfer-Encoding', 'binary', TRUE);
> $response->setHttpHeader('Accept-Length', $fileSize, TRUE);
> $response->setHttpHeader('Content-Disposition', 'attachment;
> filename='.$fileName.'.doc', TRUE);
> $response->sendHttpHeaders();
> $response->setContent(file_get_contents($filePath));
> $response->sendContent();
> return sfView::NONE;
>
> thanks !
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---