# Rails attachment\_fu db\_file upload issue

**URL:** <https://www.ruby-forum.com/t/rails-attachment-fu-db-file-upload-issue/114313>\
**Category:** Ruby\
**Created:** [September 11, 2007, 9:45am UTC](https://www.ruby-forum.com/t/rails-attachment-fu-db-file-upload-issue/114313 "2007-09-11T09:45:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkahn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@jkahn](https://www.ruby-forum.com/u/jkahn)\
**Post date:** [September 11, 2007, 9:45am UTC](https://www.ruby-forum.com/t/rails-attachment-fu-db-file-upload-issue/114313/1 "2007-09-11T09:45:48Z")

</div>

I’ve recently added attachment\_fu to my applicatons, and it works  
without reporting any errors. Works fine in :file\_system mode, but  
not in :db\_file mode. It seems to upload only about 45 bytes of data  
instead of the entire image, image download works fine when I manually  
put the data in the database.

I’ve created an Icon model that has the following has\_attachment  
settings

has\_attachment :content\_type =\> :image,  
:storage =\> :db\_file,  
:max\_size =\> 1.megabyte,  
:resize =\> ‘75x75\>’,  
:processor =\> ‘MiniMagick’

validates\_as\_attachment

I’ve removed the resize and processor statements and I’m fairly  
confident that the issue is not related to image processing. And  
again the upload works to storage type :file\_system. My controller  
create method looks like this:

def create  
@icon = Icon.new(params[:icon])  
if @icon.save  
flash[:notice] = ‘Icon was successfully created.’  
redirect\_to :action =\> ‘show’, :id =\> @icon  
else  
render :action =\> :new  
end  
end

And my ‘new’ view looks like:

\<%= error\_messages\_for :icon %\>

\<% form\_for(:icon, :url =\> {:action =\> ‘create’},  
:html =\> { :multipart =\> true }) do |f| -%\>

Upload An Icon \<%= f.file\_field :uploaded\_data %\>

\<%= submit\_tag 'Create' %\>

\<% end -%\>

Any suggestions would be greatly appreciated.

Thanks,  
j

---

<div class="post-metadata">

**Author:** ![jkahn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@jkahn](https://www.ruby-forum.com/u/jkahn)\
**Post date:** [September 11, 2007, 5:56pm UTC](https://www.ruby-forum.com/t/rails-attachment-fu-db-file-upload-issue/114313/2 "2007-09-11T17:56:39Z")

</div>

You might want to try posting this on the Rails list.

Joshua K. wrote:

> I’ve recently added attachment\_fu to my applicatons, and it works  
> without reporting any errors. Works fine in :file\_system mode, but  
> not in :db\_file mode. It seems to upload only about 45 bytes of data  
> instead of the entire image, image download works fine when I manually  
> put the data in the database.

---

<div class="post-metadata">

**Author:** ![jkahn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@jkahn](https://www.ruby-forum.com/u/jkahn)\
**Post date:** [September 11, 2007, 9:40pm UTC](https://www.ruby-forum.com/t/rails-attachment-fu-db-file-upload-issue/114313/3 "2007-09-11T21:40:44Z")

</div>

On Sep 11, 8:56 am, Paul L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Posted viahttp://www.ruby-forum.com/.  
> Would that there was a comp.lang.ruby.rails, or any usenet .rails  
> group. If there is a specific list on web somewhere that you  
> recommend that I’d appreciate if you could point me to it.

Thanks

---

<div class="post-metadata">

**Author:** ![jkahn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@jkahn](https://www.ruby-forum.com/u/jkahn)\
**Post date:** [September 11, 2007, 9:46pm UTC](https://www.ruby-forum.com/t/rails-attachment-fu-db-file-upload-issue/114313/4 "2007-09-11T21:46:45Z")

</div>

On Sep 11, 2007, at 14:40 , Joshua K. wrote:

> Would that there was a comp.lang.ruby.rails, or any usenet .rails  
> group. If there is a specific list on web somewhere that you  
> recommend that I’d appreciate if you could point me to it.

Easily found through the [rubyonrails.org](http://rubyonrails.org) home page:

[http://groups.google.com/group/rubyonrails-talk](http://groups.google.com/group/rubyonrails-talk)

Michael G.  
grzm seespotcode net

---

<div class="post-metadata">

**Author:** ![jkahn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@jkahn](https://www.ruby-forum.com/u/jkahn)\
**Post date:** [September 11, 2007, 10:26pm UTC](https://www.ruby-forum.com/t/rails-attachment-fu-db-file-upload-issue/114313/5 "2007-09-11T22:26:25Z")

</div>

On Sep 11, 12:45 pm, Michael G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Michael G.  
> grzm seespotcode net

Excellent, thanks.
