thank you , I tried as your post, but failed,
strange problem.

On 6月6日, 下午9时15分, Filipe Costa <bue...@gmail.com> wrote:
> An example the way i do it:
>
> $data = fread(fopen('uploads/assets/work_2009.doc', "r"),
> filesize('uploads/assets/work_2009.doc));
>     $response = $this->getContext()->getResponse();
>     $response->setHttpHeader('Pragma', '');
>     $response->setHttpHeader('Cache-Control', '');
>     $response->setHttpHeader('Content-Type', 'application/msword');
>     $response->setHttpHeader('Content-Disposition', 'attachment;
> filename="work_2009"');
>     $response->setContent($data);
>
>     return sfView::NONE;
>
>
>
> On Sat, Jun 6, 2009 at 2:05 PM, ctrlming <ctrlm...@gmail.com> wrote:
>
> > How can I get the MIME Type ? can you show me the codes?
>
> > On Jun 6, 9:00 pm, Filipe Costa <bue...@gmail.com> wrote:
> > > Why don't you put the MIME Type on the header?
>
> > > On Sat, Jun 6, 2009 at 1:50 PM, ctrlming <ctrlm...@gmail.com> 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 !- Hide quoted text -
>
> > > - Show quoted text -- 隐藏被引用文字 -
>
> - 显示引用的文字 -
--~--~---------~--~----~------------~-------~--~----~
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