# RE: Showing Images from a file store

**URL:** <https://www.ruby-forum.com/t/re-showing-images-from-a-file-store/93888>\
**Category:** Rails\
**Created:** [April 13, 2006, 3:42am UTC](https://www.ruby-forum.com/t/re-showing-images-from-a-file-store/93888 "2006-04-13T03:42:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [April 13, 2006, 3:42am UTC](https://www.ruby-forum.com/t/re-showing-images-from-a-file-store/93888/1 "2006-04-13T03:42:58Z")

</div>

Hi,  
Thanks a lot for the response. If you can post a working example, that  
would be great.  
Really appreciate it.  
Thanks  
Silvy Mathews

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [April 14, 2006, 12:24am UTC](https://www.ruby-forum.com/t/re-showing-images-from-a-file-store/93888/2 "2006-04-14T00:24:49Z")

</div>

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:

pdf

I know there’s an inline option as well, i.e. for a JPG

:disposition =\> ‘inline’

![]()

or something like that - hope that helps…

brez

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [April 14, 2006, 1:04am UTC](https://www.ruby-forum.com/t/re-showing-images-from-a-file-store/93888/3 "2006-04-14T01:04:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [April 14, 2006, 8:31am UTC](https://www.ruby-forum.com/t/re-showing-images-from-a-file-store/93888/4 "2006-04-14T08:31:45Z")

</div>

> 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…
