# read document

**URL:** <https://discuss.rubyonrails.org/t/read-document/32255>\
**Category:** rubyonrails-talk\
**Created:** [July 23, 2008, 10:10am UTC](https://discuss.rubyonrails.org/t/read-document/32255 "2008-07-23T10:10:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [July 23, 2008, 10:10am UTC](https://discuss.rubyonrails.org/t/read-document/32255/1 "2008-07-23T10:10:17Z")

</div>

i want to open word document file in browser, it means there will be one hyperlink if i click(ex: it's file.doc) on that it has to open the file in the browser.

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [July 23, 2008, 10:48am UTC](https://discuss.rubyonrails.org/t/read-document/32255/2 "2008-07-23T10:48:13Z")

</div>

Sujith Gangaraju wrote:

---

<div class="post-metadata">

**Author:** ![Thorsten\_Muller2](https://avatars.discourse-cdn.com/v4/letter/t/8edcca/32.png) [@Thorsten\_Muller2](https://discuss.rubyonrails.org/u/Thorsten_Muller2)\
**Post date:** [July 23, 2008, 10:59am UTC](https://discuss.rubyonrails.org/t/read-document/32255/3 "2008-07-23T10:59:45Z")

</div>

link\_to("whatever", "/docs/file.doc")

if file.doc is in a folder named docs in the public folder

what exactly happens in the browser would depend on the users settings. most likely the browser would ask him to save it

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [July 23, 2008, 11:02am UTC](https://discuss.rubyonrails.org/t/read-document/32255/4 "2008-07-23T11:02:17Z")

</div>

Thorsten Mueller wrote:

> link\_to("whatever", "/docs/file.doc")
> 
> if file.doc is in a folder named docs in the public folder
> 
> what exactly happens in the browser would depend on the users settings. most likely the browser would ask him to save it

it will download the file , but i dont want to download the file, i just want to read the file in browser itself

---

<div class="post-metadata">

**Author:** ![AndyV](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@AndyV](https://discuss.rubyonrails.org/u/AndyV)\
**Post date:** [July 23, 2008, 12:52pm UTC](https://discuss.rubyonrails.org/t/read-document/32255/5 "2008-07-23T12:52:35Z")

</div>

Make sure you set the :disposition parameter to :inline. By default (:attachment) it gets streamd for download.

send\_data '/files/my.doc', :disposition=\>:inline

[http://www.railsbrain.com/api/rails-2.1.0/doc/index.html?a=M000271&name=send\_data](http://www.railsbrain.com/api/rails-2.1.0/doc/index.html?a=M000271&name=send_data)
