# Uploading pictures to database or put them in the file syste

**URL:** <https://www.ruby-forum.com/t/uploading-pictures-to-database-or-put-them-in-the-file-syste/106794>\
**Category:** Rails\
**Created:** [June 14, 2007, 6:46am UTC](https://www.ruby-forum.com/t/uploading-pictures-to-database-or-put-them-in-the-file-syste/106794 "2007-06-14T06:46:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chamnap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@chamnap](https://www.ruby-forum.com/u/chamnap)\
**Post date:** [June 14, 2007, 6:46am UTC](https://www.ruby-forum.com/t/uploading-pictures-to-database-or-put-them-in-the-file-syste/106794/1 "2007-06-14T06:46:26Z")

</div>

Hello, guys

I want your ideas whether uploading pictures to database or uploading  
to the file system on the web server is the best way to implement? Can  
you give me pros and cons about this issue?

Thanks  
Chamnap

---

<div class="post-metadata">

**Author:** ![chamnap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@chamnap](https://www.ruby-forum.com/u/chamnap)\
**Post date:** [June 14, 2007, 7:17am UTC](https://www.ruby-forum.com/t/uploading-pictures-to-database-or-put-them-in-the-file-syste/106794/2 "2007-06-14T07:17:28Z")

</div>

File systems are much better designed for holding files than  
databases. While databases must keep all that data in the transaction  
log and be able to roll back the changes, etc., file systems generally  
do not attempt to provide that level of data integrity. As such they  
are faster and more efficient at it. Since databases require full  
pages for blobs you do not save any space placing files in the  
database either. But, if efficiency is not the issue, putting them in  
the database means you do not need to worry about orphaned files and  
so on.

Michael

---

<div class="post-metadata">

**Author:** ![chamnap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@chamnap](https://www.ruby-forum.com/u/chamnap)\
**Post date:** [June 14, 2007, 2:48pm UTC](https://www.ruby-forum.com/t/uploading-pictures-to-database-or-put-them-in-the-file-syste/106794/3 "2007-06-14T14:48:26Z")

</div>

I wrote on this a while back:

[http://www.bencurtis.com/archives/2006/11/how-to-handle-uploaded-](http://www.bencurtis.com/archives/2006/11/how-to-handle-uploaded-)  
files-with-rails/

–  
Benjamin C.  
[http://www.bencurtis.com/](http://www.bencurtis.com/) – blog  
[http://agilewebdevelopment.com/rails-ecommerce](http://agilewebdevelopment.com/rails-ecommerce) – build e-commerce  
sites with Rails

---

<div class="post-metadata">

**Author:** ![chamnap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@chamnap](https://www.ruby-forum.com/u/chamnap)\
**Post date:** [June 14, 2007, 8:50pm UTC](https://www.ruby-forum.com/t/uploading-pictures-to-database-or-put-them-in-the-file-syste/106794/4 "2007-06-14T20:50:35Z")

</div>

if you are uploading lots of images, I say neither - use amazon s3 🙂

-Andrew K.  
[http://beginsinwonder.com](http://beginsinwonder.com)

On 6/14/07, Benjamin C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [http://agilewebdevelopment.com/rails-ecommerce](http://agilewebdevelopment.com/rails-ecommerce) – build e-commerce
> 
> > you give me pros and cons about this issue?
> > 
> > Thanks  
> > Chamnap
> 
> >

–  
Andrew K.
