# Attachement\_fu physical storage structure

**URL:** <https://www.ruby-forum.com/t/attachement-fu-physical-storage-structure/143884>\
**Category:** Rails\
**Created:** [July 23, 2008, 2:47pm UTC](https://www.ruby-forum.com/t/attachement-fu-physical-storage-structure/143884 "2008-07-23T14:47:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MW\_Administrator](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aeb1de/32.png) [@MW\_Administrator](https://www.ruby-forum.com/u/MW_Administrator)\
**Post date:** [July 23, 2008, 2:47pm UTC](https://www.ruby-forum.com/t/attachement-fu-physical-storage-structure/143884/1 "2008-07-23T14:47:01Z")

</div>

Hi -

Can someone explain how/why attachment\_fu stores its files the way it  
does? I noticed that it creates a directory for each upload and am  
curious how it determines this and/or the methodology.

Thanks!

---

<div class="post-metadata">

**Author:** ![MW\_Administrator](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aeb1de/32.png) [@MW\_Administrator](https://www.ruby-forum.com/u/MW_Administrator)\
**Post date:** [July 23, 2008, 4:56pm UTC](https://www.ruby-forum.com/t/attachement-fu-physical-storage-structure/143884/2 "2008-07-23T16:56:49Z")

</div>

On 23 Jul 2008, at 13:02, MW Administrator wrote:

> Can someone explain how/why attachment\_fu stores its files the way it  
> does? I noticed that it creates a directory for each upload and am  
> curious how it determines this and/or the methodology.

It creates a directory for each model you define with “has\_attachment”  
within the public folder (although you can change the storage path if  
you want to). Then it creates partitioned folders by default based on  
the id of your model record (this can disabled if you want to). For  
record with id=1 in your Document model, it will create documents/  
0000/0001/file.ext. The reason why it partitions the folders has to do  
with filesystem limits iirc. Some storage systems have a limit to the  
number of folders within a directory.

The best thing to do, is just browse through the source code (or rdoc)  
of the plugin yourself, it’s well documented and tells you all you  
need to know.

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![MW\_Administrator](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aeb1de/32.png) [@MW\_Administrator](https://www.ruby-forum.com/u/MW_Administrator)\
**Post date:** [July 23, 2008, 4:59pm UTC](https://www.ruby-forum.com/t/attachement-fu-physical-storage-structure/143884/3 "2008-07-23T16:59:11Z")

</div>

Thank you - this makes sense and re-assures some speculations.
