# Downloading the files shows data instead of download box

**URL:** <https://www.ruby-forum.com/t/downloading-the-files-shows-data-instead-of-download-box/171597>\
**Category:** Ruby\
**Created:** [July 6, 2009, 2:03pm UTC](https://www.ruby-forum.com/t/downloading-the-files-shows-data-instead-of-download-box/171597 "2009-07-06T14:03:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vamsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b38774/32.png) [@vamsi](https://www.ruby-forum.com/u/vamsi)\
**Post date:** [July 6, 2009, 2:03pm UTC](https://www.ruby-forum.com/t/downloading-the-files-shows-data-instead-of-download-box/171597/1 "2009-07-06T14:03:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vamsi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b38774/32.png) [@vamsi](https://www.ruby-forum.com/u/vamsi)\
**Post date:** [July 6, 2009, 5:14pm UTC](https://www.ruby-forum.com/t/downloading-the-files-shows-data-instead-of-download-box/171597/2 "2009-07-06T17:14:16Z")

</div>

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)
