Downloading the files shows data instead of download box


i’m saving a file in the database( the content of file.) and i provided
an option like downloadlink. if i click on that the file should be
downloaded but it shows the content of the file on the webpage instead
of downloading.
i tried both send_file and send_data but of no use.

and i got download box when i click on the link for an image file but i
want to download a .rb file from my app.

[email protected]
send_data content, :type=>‘application/octet-stream’, :disposition =>
‘attachement’, :x_sendfile => true

it displays the content of the file in the webpage. even i used
send_file but not of use.

So let me know is there any secured options for downloading a file of
any extension( especially .rb).


Vamsi K. wrote:

send_data content, :type=>‘application/octet-stream’, :disposition =>
‘attachement’, :x_sendfile => true

Probably you need ‘attachment’ not ‘attachement’

That looks like a Rails method to me. Rails methods would be best asked
on a Rails mailing list. (Ruby != Rails)