# Send\_file

**URL:** <https://www.ruby-forum.com/t/send-file/170739>\
**Category:** Rails\
**Created:** [June 22, 2009, 10:58am UTC](https://www.ruby-forum.com/t/send-file/170739 "2009-06-22T10:58:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vetrivel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/dc4da7/32.png) [@vetrivel](https://www.ruby-forum.com/u/vetrivel)\
**Post date:** [June 22, 2009, 10:58am UTC](https://www.ruby-forum.com/t/send-file/170739/1 "2009-06-22T10:58:52Z")

</div>

send\_file method is not working in rails . Here i have mentioned my  
program . The program is

filename = File.join(RAILS\_ROOT, ‘public’, ‘4000.xls’)

```
      send_file_options = {
      :length => File.size( filename ),
      :disposition => 'inline',
      :status => "200 OK"
      }

```

send\_file( filename , send\_file\_options ). Please help me to solve  
this issue.

---

<div class="post-metadata">

**Author:** ![vetrivel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/dc4da7/32.png) [@vetrivel](https://www.ruby-forum.com/u/vetrivel)\
**Post date:** [June 22, 2009, 11:06am UTC](https://www.ruby-forum.com/t/send-file/170739/2 "2009-06-22T11:06:08Z")

</div>

On Mon, Jun 22, 2009 at 10:58 AM, Vetrivel  
Vetrivel[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> }
> 
> ```
> 
> send\_file( filename , send\_file\_options ). Please help me to solve  
> this issue.

I can’t see why the code doesn’t work, other than the file may not be  
there.  
I do see however that you’re streaming out of ‘public’ so you could  
just link to 4000.xls and bypass using Rails (it will be quicker and  
free up Rails to handle the next request)

Andrew T.  
[http://ramblingsonrails.com](http://ramblingsonrails.com)

[http://MyMvelope.com](http://MyMvelope.com) - The SIMPLE way to manage your savings
