Hi everybody: i would like to ask your help with this problem i have.
I think it's more http than symfony:
I have an action which does some queries into the database and at the
end displays them in a nice page. Now i need to export the results in
a csv format. By click a button in the results page, hopefully that
will be done.
The problems i have are:
1) The output report does not exists. It's generated on the fly in the
action. I want the user to be able to download this 'file'. I started
creating another simple view which just displays the two columns
separated by a comma plus '\n'. I use setTemplate ('CVSreport') and
the code to 'create' the file is there: it's just three lines of code
and diplays data separated by a comma.
But the problem is that it's being displayed on the screen. If i see
the source code, i verify that it's ok but i need to have the browser
to download this "file". I wonder myself: is it compulsory that the
file be previously saved (in a temp file i suppose) and then sent
through headers ('Content-Disposition=attachment,
filename=mytempfile') ??
If so, here comes my second question:
2) how do i do for, that after sending the 'headers' code, the
application displays another view like for example
"AfterDownloadSuccess" ? or can't i ? by now i'm "creating the file"
in the view not in the controller. Also, after using header and
sending the type as attachment and doing the readfile () and so on, it
works. But it stops there. If i add a header like "Location: xxx" it
will jump to that one without processing the download.
I appreciate your help. I found some information about how to download
files through symfony but here it's not about downloading (the file is
generated on the fly) and none said how to display a view after the
the download (something like a "Redirect_after_download").
Julian Llanten
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---