# Upload File

**URL:** <https://www.ruby-forum.com/t/upload-file/89281>\
**Category:** Rails\
**Created:** [March 19, 2007, 10:53am UTC](https://www.ruby-forum.com/t/upload-file/89281 "2007-03-19T10:53:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hasana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d78d45/32.png) [@hasana](https://www.ruby-forum.com/u/hasana)\
**Post date:** [March 19, 2007, 10:53am UTC](https://www.ruby-forum.com/t/upload-file/89281/1 "2007-03-19T10:53:04Z")

</div>

How to upload file to database for example file jpeg.

---

<div class="post-metadata">

**Author:** ![hasana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d78d45/32.png) [@hasana](https://www.ruby-forum.com/u/hasana)\
**Post date:** [March 19, 2007, 11:27am UTC](https://www.ruby-forum.com/t/upload-file/89281/2 "2007-03-19T11:27:32Z")

</div>

Hi Hasana

Look at acts\_as\_attachment. I have used it and it works great. The  
alternative is file\_column but I struggled to get it going properly and  
dit  
not find it as intuitive as acts\_as\_attachment.

[http://technoweenie.stikipad.com/plugins/show/Acts+as+Attachment](http://technoweenie.stikipad.com/plugins/show/Acts+as+Attachment)

The default behaviour is to upload the files to a directory in the  
public  
folder of your app, and store the URI of the file in the database as a  
string, however, I believe you can also save the files in binary in the  
database…

If you install rmagick you will be able to do some nice stuff with  
images as  
you upload them, like create a thumbnail version of the image aswell.

Regards  
Ivor
