Thanks a lot for the response. If you can post a working example, that
would be great.
Really appreciate it.
Here’s a [very] rough, but working example for a PDF…
class FileGrabberController < ApplicationController
@@path = ‘your/path’
send_file @@path + ‘a.pdf’, :type => ‘application/pdf’
I know there’s an inline option as well, i.e. for a JPG
:disposition => ‘inline’
or something like that - hope that helps…
That really worked. I did not knew that we could specify a controller
and the method name inside the view. Thanks a lot. Really appreciate
That really worked.
good to hear…
I did not knew that we could specify a controller
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