Downloading the files shows data instead of download box

Hi

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).

Thanks
VamsiKrishna.

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)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs