Hi, in my application i want to develop a code where when i click on
download link , csv file get downloaded to client side.
so for this i put
Download the group template (requires Excel).(download_template.csv
is my public dir.)
code in rhtml.its working correctly for IE but in Mozilla it directly
open in browser instade that it ask for pop up, how should i do it?
reinhart
On May 20, 2008, at 3:53 AM, Sunny B. wrote:
open in browser instade that it ask for pop up, how should i do it?
send_file( 'public/download_template.csv',
:type => 'text/csv',
:disposition => 'attachment',
:stream => true,
:filename => 'download_template.csv' )
Except for :type, the other options are the defaults.
-Rob
Rob B. wrote:
On May 20, 2008, at 3:53 AM, Sunny B. wrote:
open in browser instade that it ask for pop up, how should i do it?
send_file( 'public/download_template.csv', :type => 'text/csv', :disposition => 'attachment', :stream => true, :filename => 'download_template.csv' )Except for :type, the other options are the defaults.
-Rob
This code is OK ,but where to put this code in rhtml ya in separate
method.
if i am write new methos it give template error (rhtml missing),and in
rhtml how i used it?
On May 21, 2008, at 1:01 AM, Sunny B. wrote:
:stream => true,method.
if i am write new methos it give template error (rhtml missing),and in
rhtml how i used it?
As you could determine from the documentation link (if not from the
documentation itself), this is part of ActionController. It goes into
an action method and takes the place of a render or redirect.
Typically, you use send_file (or send_data) when the file is not
visible in the standard directory structure (i.e., not under public/)
or when you want to base the response on some calculation or property
of the request.
-Rob
P.S. There are many who see these messages as email and not in the
forum. Please do not post the same question in multiple places.