The problem was solved when I used an ordinary form instead of AJAX
one.

On Aug 11, 4:04 pm, juzek <joo...@gmail.com> wrote:
> //content-disposition, attachement// sets only filename under which
> the file will be saved from the browser.
> it doesn't send the file to the browser , in  fact.
>
> Try using
>
> $this->renderText('sample text from the file')
>
> after setting the headers.
>
> that text will be send as a file to the browser.
>
> Sumedh napisał(a):
>
> > One more thing to add...
>
> > We are trying this through an AJAX action...
>
> > could that be a problem?
>
> > On Aug 10, 4:13 pm, Sumedh <sumedh.inam...@gmail.com> wrote:
> > > Hi Friends,
>
> > > We are trying to download a file in Symfony 1.0 action...
>
> > > But it just returns the content as text in the HTTP response and the
> > > file-save dialog of the browser doesn't appear at all... :(
>
> > > Here is the snippet from action. It tries to send a couple of words as
> > > a PDF file -
>
> > > $filename="ravi.pdf";
>
> > > $this->getResponse()->setHttpHeader('Pragma', 'public');
>
> > > $this->getResponse()->setHttpHeader("Content-Description","File
> > > Transfer");
>
> > > $this->getResponse()->setContentType('application/pdf',TRUE);
>
> > > $this->getResponse()->setHttpHeader('content-transfer-encoding',
> > > 'binary', TRUE);
>
> > > $this->getResponse()->setHttpHeader("Content-Disposition","attachment;
> > > filename=\"".$filename."\"", TRUE);
>
> > > $this->getResponse()->sendHttpHeaders();
>
> > > $this->getResponse()->setContent("sample content");
>
> > > return sfView::NONE;
>
> > > What's the issue with the code?
>
> > > Thanks a lot for reading... :)
--~--~---------~--~----~------------~-------~--~----~
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