read document

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.

Sujith Gangaraju 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

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

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