Downloading the files shows data instead of download box.

Discussion in 'Ruby' started by Vamsi Krishna, Jul 6, 2009.

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


    content=@file.content
    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.
    --
    Posted via http://www.ruby-forum.com/.
     
    Vamsi Krishna, Jul 6, 2009
    #1
    1. Advertising

  2. Vamsi Krishna 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)
    --
    Posted via http://www.ruby-forum.com/.
     
    Brian Candler, Jul 6, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Don Peters
    Replies:
    2
    Views:
    583
    Don Peters
    Oct 26, 2003
  2. gce
    Replies:
    0
    Views:
    786
  3. The wee free man

    files show as ascii instead of downloading

    The wee free man, Jun 19, 2004, in forum: HTML
    Replies:
    3
    Views:
    338
    The wee free man
    Jun 19, 2004
  4. Stu
    Replies:
    7
    Views:
    246
    Steven Burn
    Jan 15, 2004
  5. Gianni

    IE shows false and Firefox shows true

    Gianni, Jul 10, 2009, in forum: Javascript
    Replies:
    3
    Views:
    481
    Thomas 'PointedEars' Lahn
    Jul 10, 2009
Loading...

Share This Page