Hi, Thanks a lot for the response. If you can post a working example, that would be great. Really appreciate it. Thanks Silvy Mathews
on 2006-04-13 05:42
on 2006-04-14 02:24
Here's a [very] rough, but working example for a PDF.. Controller: class FileGrabberController < ApplicationController @@path = 'your/path' def get_file send_file @@path + 'a.pdf', :type => 'application/pdf' end end View: <a href="file_grabber/get_file">pdf</a> I know there's an inline option as well, i.e. for a JPG :disposition => 'inline' <img src="file_grabber/get_image"/> or something like that - hope that helps.. brez
on 2006-04-14 03:04
Hi John, That really worked. I did not knew that we could specify a controller name and the method name inside the view. Thanks a lot. Really appreciate that. Thanks Silvy
on 2006-04-14 10:31
> That really worked. good to hear.. >I did not knew that we could specify a controller > name > and the method name inside the view. well what youre really specifying is a URL that is interpreted as that method on that controller, i.e. the rails convention for URL mapping. The browser then retrieves the img like a typical JPG. send_file returns a byte stream [i.e. no HTTP headers, etc] which is subsequently rendered.. It all pretty straightforward actually - it's probably worth reading abt the HTTP 1.1 protocol if you found the previous few lines compelling..