Using send_file in rails

Posted by user163352 on Stack Overflow See other posts from Stack Overflow or by user163352
Published on 2010-04-18T16:39:09Z Indexed on 2010/04/18 16:43 UTC
Read the original article Hit count: 164

Filed under:

I'm sending a ms-word file using rails. i.e when I click on a link, a doc file from tmp folder(in project) is sent.

The code I'm using is

@filename ="#{RAILS_ROOT}/tmp/test/test.doc"
send_file(@filename ,
            :filename      =>  "test",
            :type          =>  'application/msword',
            :disposition  =>  'attachment',
            :streaming    =>  'true',
        :buffer_size  =>  '4096')

Its working, but its sending a empty file. Content is missing in the file.

any suggestions??

© Stack Overflow or respective owner

Related posts about ruby-on-rails