# Inline file upload error: undefined method \`size='

**URL:** <https://www.ruby-forum.com/t/inline-file-upload-error-undefined-method-size/131992>\
**Category:** Rails\
**Created:** [March 14, 2008, 10:11pm UTC](https://www.ruby-forum.com/t/inline-file-upload-error-undefined-method-size/131992 "2008-03-14T22:11:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [March 14, 2008, 10:11pm UTC](https://www.ruby-forum.com/t/inline-file-upload-error-undefined-method-size/131992/1 "2008-03-14T22:11:41Z")

</div>

Hello,

I followed the tutorial at:  
[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)

However, in my controller I am getting the error:

NoMethodError (undefined method `size=’ for #SwfImage:0x5705b48)

Other references to this error indicate that the render method is  
trying to render a string (which does have a size method) but it’s  
attempting to render the SwfImage object instead. So how would I get  
around this? Any help would be appreciated.

#### VIEW CODE

\<% form\_for(:swf\_image, :url =\> formatted\_swf\_images\_path(:format =\>  
‘js’), :html =\> { :multipart =\> true, :target =\> ‘upload\_frame’ }) do |  
f| %\>

**Filename**  
 \<%= f.file\_field :uploaded\_data %\>

\<%= f.submit "Create" %\>

\<% end %\>
#### CONTROLLER CODE

def create  
@swf\_image = SwfImage.new(params[:swf\_image])

```
respond_to do |format|
  if @swf_image.save
    flash[:notice] = 'Image was successfully saved.'
    format.html { redirect_to(@swf_image) }
    format.js do
      responds_to_parent do
        render :update do |page|
          page.insert_html :bottom, "swf_images", :partial =>

```

‘swf\_images/image’, :object =\> @swf\_image  
page.visual\_effect :highlight, “image\_#{@swf\_image.id}”  
end  
end  
end  
else  
format.html { render :action =\> “new” }  
format.js do  
responds\_to\_parent do  
render :update do |page|  
# do nothing  
end  
end  
end  
end  
end  
end
