# wierd problem with attachment\_fu plugin?

**URL:** <https://discuss.rubyonrails.org/t/wierd-problem-with-attachment-fu-plugin/14953>\
**Category:** rubyonrails-talk\
**Created:** [June 27, 2007, 3:54am UTC](https://discuss.rubyonrails.org/t/wierd-problem-with-attachment-fu-plugin/14953 "2007-06-27T03:54:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chirag2](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@chirag2](https://discuss.rubyonrails.org/u/chirag2)\
**Post date:** [June 27, 2007, 3:54am UTC](https://discuss.rubyonrails.org/t/wierd-problem-with-attachment-fu-plugin/14953/1 "2007-06-27T03:54:43Z")

</div>

I'm using the attachment\_fu plugin in the following manner to upload a file. [http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment\_fu-and-responds\_to\_parent](http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent)

I ge tthe following error if I upload a file that's over 1K or so. It works fine for small files (500 bytes or so):

&nbsp;&nbsp;&nbsp;&nbsp;1 error prohibited this raw data file from being saved &nbsp;&nbsp;&nbsp;&nbsp;There were problems with the following fields: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\* Size is not included in the list

This is using the POST action in the scaffold\_resource generated controller

Chirag

&nbsp;&nbsp;# POST /raw\_data\_files &nbsp;&nbsp;# POST /raw\_data\_files.xml &nbsp;&nbsp;def create &nbsp;&nbsp;&nbsp;&nbsp;@raw\_data\_file = RawDataFile.new(params[:raw\_data\_file])

&nbsp;&nbsp;&nbsp;&nbsp;respond\_to do |format| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if @raw\_data\_file.save &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flash[:notice] = 'RawDataFile was successfully created.' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format.html { redirect\_to raw\_data\_file\_url(@raw\_data\_file) } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format.xml { head :created, :location =\> raw\_data\_file\_url(@raw\_data\_file) } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format.html { render :action =\> "new" } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format.xml { render :xml =\> @raw\_data\_file.errors.to\_xml } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;end

---

<div class="post-metadata">

**Author:** ![Rick\_Olson](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@Rick\_Olson](https://discuss.rubyonrails.org/u/Rick_Olson)\
**Post date:** [June 27, 2007, 6:25am UTC](https://discuss.rubyonrails.org/t/wierd-problem-with-attachment-fu-plugin/14953/2 "2007-06-27T06:25:43Z")

</div>

That's a validation error. Either you set your min/max values incorrectly, or you don't have rmagick/imagescience/minimagick so that attachment\_fu can set the correct size.

---

<div class="post-metadata">

**Author:** ![chirag2](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@chirag2](https://discuss.rubyonrails.org/u/chirag2)\
**Post date:** [June 27, 2007, 8:28pm UTC](https://discuss.rubyonrails.org/t/wierd-problem-with-attachment-fu-plugin/14953/3 "2007-06-27T20:28:55Z")

</div>

I changed the following line in the model from

:max\_size =\> 2.megabytes

to :size =\> 0.megabyte..2.megabytes

and it worked. Thanks rick!
