# Upload images and displaying of images

**URL:** <https://www.ruby-forum.com/t/upload-images-and-displaying-of-images/122286>\
**Category:** Rails\
**Created:** [December 6, 2007, 7:35am UTC](https://www.ruby-forum.com/t/upload-images-and-displaying-of-images/122286 "2007-12-06T07:35:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![koli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/41988e/32.png) [@koli](https://www.ruby-forum.com/u/koli)\
**Post date:** [December 6, 2007, 7:35am UTC](https://www.ruby-forum.com/t/upload-images-and-displaying-of-images/122286/1 "2007-12-06T07:35:23Z")

</div>

Hi,  
I am using ruby with postgresql,  
I want to know how to upload images to path and  
then store the path in the database.i would not like to store the images  
in  
database .  
i also want to know how to display the uploaded images.

-koli

---

<div class="post-metadata">

**Author:** ![koli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/41988e/32.png) [@koli](https://www.ruby-forum.com/u/koli)\
**Post date:** [December 6, 2007, 11:43am UTC](https://www.ruby-forum.com/t/upload-images-and-displaying-of-images/122286/2 "2007-12-06T11:43:06Z")

</div>

Hi,

Well you can create a multi-part form with a file input, submit the  
form…  
get the image data from the uploaded image and store it in a binary  
field.  
For showing it again, um, perhaps a controller action to show images  
which  
uses send\_data. A much nicer way would not to store images in the  
database,  
such as looking at the file\_column or attachment\_fu plugins.

Cheers,  
James

---

<div class="post-metadata">

**Author:** ![koli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/41988e/32.png) [@koli](https://www.ruby-forum.com/u/koli)\
**Post date:** [December 6, 2007, 12:00pm UTC](https://www.ruby-forum.com/t/upload-images-and-displaying-of-images/122286/3 "2007-12-06T12:00:51Z")

</div>

James Brooks wrote:

> Hi,
> 
> Well you can create a multi-part form with a file input, submit the  
> form…  
> get the image data from the uploaded image and store it in a binary  
> field.  
> For showing it again, um, perhaps a controller action to show images  
> which  
> uses send\_data. A much nicer way would not to store images in the  
> database,  
> such as looking at the file\_column or attachment\_fu plugins.
> 
> Cheers,  
> James

Thanks for the reply.downloaded file\_column and got it working.  
the other thing what i want it add comments along with the images.  
i want the comments also to be shown with the images .how do i do it??

---

<div class="post-metadata">

**Author:** ![koli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/41988e/32.png) [@koli](https://www.ruby-forum.com/u/koli)\
**Post date:** [December 6, 2007, 12:51pm UTC](https://www.ruby-forum.com/t/upload-images-and-displaying-of-images/122286/4 "2007-12-06T12:51:43Z")

</div>

Thorsten M. wrote:

> > Thanks for the reply.downloaded file\_column and got it working.  
> > the other thing what i want it add comments along with the images.  
> > i want the comments also to be shown with the images .how do i do it??
> 
> simply add a textfield to the form and store the content in the db,  
> together with the pa

Thanks for the reply.one more thing i wanted to know was how to display  
images  
as thumnails as soon as uploaded.  
An example would be helpful.

-Koli

---

<div class="post-metadata">

**Author:** ![koli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/41988e/32.png) [@koli](https://www.ruby-forum.com/u/koli)\
**Post date:** [December 6, 2007, 6:18pm UTC](https://www.ruby-forum.com/t/upload-images-and-displaying-of-images/122286/5 "2007-12-06T18:18:05Z")

</div>

I suggest you look at the attachment\_fu plugin.

---

<div class="post-metadata">

**Author:** ![koli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/41988e/32.png) [@koli](https://www.ruby-forum.com/u/koli)\
**Post date:** [December 6, 2007, 12:23pm UTC](https://www.ruby-forum.com/t/upload-images-and-displaying-of-images/122286/6 "2007-12-06T12:23:36Z")

</div>

> Thanks for the reply.downloaded file\_column and got it working.  
> the other thing what i want it add comments along with the images.  
> i want the comments also to be shown with the images .how do i do it??

simply add a textfield to the form and store the content in the db,  
together with the path
