# AssetManager Controlling Where Files are Saved

**URL:** <https://www.ruby-forum.com/t/assetmanager-controlling-where-files-are-saved/84551>\
**Category:** Radiant CMS\
**Created:** [February 5, 2007, 11:00pm UTC](https://www.ruby-forum.com/t/assetmanager-controlling-where-files-are-saved/84551 "2007-02-05T23:00:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluetrust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8e7dd6/32.png) [@bluetrust](https://www.ruby-forum.com/u/bluetrust)\
**Post date:** [February 5, 2007, 11:00pm UTC](https://www.ruby-forum.com/t/assetmanager-controlling-where-files-are-saved/84551/1 "2007-02-05T23:00:25Z")

</div>

I wanted to put this out there to possibly help someone and also to  
get any feedback if this is the wrong way to do it…

By default the AssetManager saves uploaded files in public/assets/ID/

I wanted files to be saves in the public/images directory.

To do that edit asset.rb the acts\_as\_attachment line to be:

acts\_as\_attachment :storage =\> :file\_system, :file\_system\_path =\>  
‘public/images’,  
:max\_size =\> 2048.kilobytes, :content\_type =\> :image,  
:thumbnails =\> { :normal =\> ‘600x400’, :thumbnail =\> ‘100x100’, :icon  
=\> ‘42x42’ }

Note I added:  
“:file\_system\_path =\> ‘public/images’,”

This got the images saved in the public/images directory however it  
still created a directory for the ID so images were stored like  
public/images/3/\*.jpg

To get them in the ‘images’ directory override the “full\_filename”  
method to asset.rb:

def full\_filename(thumbnail = nil)  
file\_system\_path = (thumbnail ? thumbnail\_class :  
self).attachment\_options[:file\_system\_path]  
#File.join(RAILS\_ROOT, file\_system\_path,  
attachment\_path\_id,thumbnail\_name\_for(thumbnail))  
File.join(RAILS\_ROOT, file\_system\_path, thumbnail\_name\_for(thumbnail))  
end

Note I commented out the first File.join line and aded a new one minus  
the “attachment\_path\_id”

Hope this helps and again if this is a bad idea someone please tell me!

Thanks-  
Michael
