# Attachment\_fu :uploaded\_data

**URL:** <https://www.ruby-forum.com/t/attachment-fu-uploaded-data/132374>\
**Category:** Rails\
**Created:** [March 19, 2008, 3:18pm UTC](https://www.ruby-forum.com/t/attachment-fu-uploaded-data/132374 "2008-03-19T15:18:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xinu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f6c823/32.png) [@xinu](https://www.ruby-forum.com/u/xinu)\
**Post date:** [March 19, 2008, 3:18pm UTC](https://www.ruby-forum.com/t/attachment-fu-uploaded-data/132374/1 "2008-03-19T15:18:31Z")

</div>

Hi.  
In my Model DesignThumbnail I use Attachment\_fu.

## ----------------- Model ------------------------------- class DesignThumbnail \< ActiveRecord::Base has\_attachment :content\_type =\> :image, :storage =\> :file\_system, :max\_size =\> 150.kilobytes, :resize\_to =\> ‘86x170\>’ validates\_as\_attachment … end

Instead of uploading the image with a form I want to use a stored image.

----------------- Controller -----------  
@thumb = DesignThumbnail.new  
@thumb.uploaded\_data =  
File.open("#{RAILS\_ROOT}/public/images/sample.jpg")

## if @thumb.save flash[:notice] = ‘Image was successfully created.’ redirect\_to … else render … end

I receive the error message  
“undefined method `size’ for #\<File:0x2aaaacf79118\>”

vendor/plugins/attachment\_fu/lib/technoweenie/attachment\_fu.rb:288:in  
`uploaded\_data=’  
…

thanks  
Michael
