# Read document

**URL:** <https://www.ruby-forum.com/t/read-document/143871>\
**Category:** Rails\
**Created:** [July 23, 2008, 12:10pm UTC](https://www.ruby-forum.com/t/read-document/143871 "2008-07-23T12:10:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sujith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@sujith](https://www.ruby-forum.com/u/sujith)\
**Post date:** [July 23, 2008, 12:10pm UTC](https://www.ruby-forum.com/t/read-document/143871/1 "2008-07-23T12: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:** ![sujith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@sujith](https://www.ruby-forum.com/u/sujith)\
**Post date:** [July 23, 2008, 12:48pm UTC](https://www.ruby-forum.com/t/read-document/143871/2 "2008-07-23T12:48:13Z")

</div>

Sujith Gangaraju wrote:

> 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:** ![sujith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@sujith](https://www.ruby-forum.com/u/sujith)\
**Post date:** [July 23, 2008, 1:00pm UTC](https://www.ruby-forum.com/t/read-document/143871/3 "2008-07-23T13:00:10Z")

</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:** ![sujith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@sujith](https://www.ruby-forum.com/u/sujith)\
**Post date:** [July 23, 2008, 1:02pm UTC](https://www.ruby-forum.com/t/read-document/143871/4 "2008-07-23T13:02:17Z")

</div>

Thorsten M. 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:** ![sujith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@sujith](https://www.ruby-forum.com/u/sujith)\
**Post date:** [July 23, 2008, 2:52pm UTC](https://www.ruby-forum.com/t/read-document/143871/5 "2008-07-23T14:52:53Z")

</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)

On Jul 23, 7:02 am, Sujith Gangaraju \<rails-mailing-l…@andreas-
