# Way to limit file upload size using file\_column or attachment\_fu

**URL:** <https://www.ruby-forum.com/t/way-to-limit-file-upload-size-using-file-column-or-attachment-fu/144464>\
**Category:** Rails\
**Created:** [July 29, 2008, 9:20pm UTC](https://www.ruby-forum.com/t/way-to-limit-file-upload-size-using-file-column-or-attachment-fu/144464 "2008-07-29T21:20:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/76d3ee/32.png) [@DavidB](https://www.ruby-forum.com/u/DavidB)\
**Post date:** [July 29, 2008, 9:20pm UTC](https://www.ruby-forum.com/t/way-to-limit-file-upload-size-using-file-column-or-attachment-fu/144464/1 "2008-07-29T21:20:30Z")

</div>

While I know this can be done with some flas based solutions, how can  
one limit the size of an upload to an RoR application within the  
application rather than via apache’s configuration? I just don’t want  
anyone trying to upload a 100mb file.

thanks

David

---

<div class="post-metadata">

**Author:** ![DavidB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/76d3ee/32.png) [@DavidB](https://www.ruby-forum.com/u/DavidB)\
**Post date:** [July 29, 2008, 10:47pm UTC](https://www.ruby-forum.com/t/way-to-limit-file-upload-size-using-file-column-or-attachment-fu/144464/2 "2008-07-29T22:47:28Z")

</div>

DavidB wrote:

> While I know this can be done with some flas based solutions, how can  
> one limit the size of an upload to an RoR application within the  
> application rather than via apache’s configuration? I just don’t want  
> anyone trying to upload a 100mb file.

Haven’t used FileColumn though I know that you can configure the :size  
parameter of has\_attachment in attachment\_fu. You’ll subsequently want  
to use the built-in validates\_as\_attachment too.

I’ve heard good stories about the Paperclip plugin - you might want to  
check out that one too.

–  
Roderick van Domburg

> **[De domeinnaam Nedforce.nl is te koop.](http://www.nedforce.nl)**
>
> Deze mooie domeinnaam kan al over een paar minuten van jou zijn. Betalen gaat eenvoudig en vertrouwd via iDEAL. Direct na de betaling ontvang je de verhuiscode per e-mail en kun je aan de slag.

---

<div class="post-metadata">

**Author:** ![DavidB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/76d3ee/32.png) [@DavidB](https://www.ruby-forum.com/u/DavidB)\
**Post date:** [July 30, 2008, 3:18pm UTC](https://www.ruby-forum.com/t/way-to-limit-file-upload-size-using-file-column-or-attachment-fu/144464/3 "2008-07-30T15:18:17Z")

</div>

Check out Attachment Fu plugin. It has options for setting the max  
limit on the size of the file that can be uploaded. I am no expert in  
it, but don’t need to. I just followed the recipes in Advanced Rails  
Recipes by Mike C… Well worth the money since you can quickly  
find out the answers to these questions.  
Bharat
