# Has anyone used file\_column to store the upload file in DB?

**URL:** <https://www.ruby-forum.com/t/has-anyone-used-file-column-to-store-the-upload-file-in-db/172832>\
**Category:** Rails\
**Created:** [July 28, 2009, 6:00pm UTC](https://www.ruby-forum.com/t/has-anyone-used-file-column-to-store-the-upload-file-in-db/172832 "2009-07-28T18:00:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sultan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aeb1de/32.png) [@sultan](https://www.ruby-forum.com/u/sultan)\
**Post date:** [July 28, 2009, 6:00pm UTC](https://www.ruby-forum.com/t/has-anyone-used-file-column-to-store-the-upload-file-in-db/172832/1 "2009-07-28T18:00:49Z")

</div>

Has anyone used file\_column to store the upload file in DB?

I have a requirement to upload files and store in the database instead  
of the file system. The upload file can be any type, images or  
documents, .doc, .xls, .pdf…

I can find plenty of examples of file\_column that store the actual  
file in the file system.

I need help to figure out how to store the document in the database.

---

<div class="post-metadata">

**Author:** ![sultan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aeb1de/32.png) [@sultan](https://www.ruby-forum.com/u/sultan)\
**Post date:** [July 29, 2009, 6:29am UTC](https://www.ruby-forum.com/t/has-anyone-used-file-column-to-store-the-upload-file-in-db/172832/2 "2009-07-29T06:29:05Z")

</div>

> I need help to figure out how to store the document in the database.

The DB storage needs to be a BLOB (or the equivalent) since you want to  
store an arbitrary number of types of ‘things’ of presumably arbitrary  
size. There is a resource out there on the web, somewhere (if I could  
recall where, the link would be yours, but I seem to recall muddling  
through it with attachment\_fu, so you might want to check those  
references).

I did that personally as a proof of concept in my app about a year ago,  
but found the DB storage and retrieval much, much too slow as compared  
to the file system.
