# Attachment\_fu dynamic max\_size

**URL:** <https://www.ruby-forum.com/t/attachment-fu-dynamic-max-size/129561>\
**Category:** Rails\
**Created:** [February 19, 2008, 6:09pm UTC](https://www.ruby-forum.com/t/attachment-fu-dynamic-max-size/129561 "2008-02-19T18:09:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![n1c](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/3ec8ea/32.png) [@n1c](https://www.ruby-forum.com/u/n1c)\
**Post date:** [February 19, 2008, 6:09pm UTC](https://www.ruby-forum.com/t/attachment-fu-dynamic-max-size/129561/1 "2008-02-19T18:09:41Z")

</div>

I’m using attachment\_fu for uploading photos. I’d like to set the  
max\_size parameter based on the user’s account level. So I have a field  
in the account\_plans table that stores the max\_size allowed for that  
plan.

This doesn’t work, but it should give an idea of what I’m trying to  
achieve…

has\_attachment :content\_type =\> :image,  
:storage =\> :s3,  
:path\_prefix =\> ‘public/uploaded\_photos’,  
:max\_size =\>  
self.event.account\_plan.max\_filesize.kilobytes,  
:s3\_access =\> :public\_read

What is the correct way for me to do this?

Thx  
Nick
