# File\_send confused

**URL:** <https://www.ruby-forum.com/t/file-send-confused/140725>\
**Category:** Rails\
**Created:** [June 17, 2008, 11:34pm UTC](https://www.ruby-forum.com/t/file-send-confused/140725 "2008-06-17T23:34:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 17, 2008, 11:34pm UTC](https://www.ruby-forum.com/t/file-send-confused/140725/1 "2008-06-17T23:34:37Z")

</div>

Anyone see where I am going wrong here?

Error = undefined method `filename=’

Model

class Upload \< ActiveRecord::Base  
def upload=(upload\_field)  
self.filename = upload\_field.original\_filename  
self.content\_type = upload\_field.content\_type.chomp  
self.binary\_data = upload\_field.read  
end

end

Controller

def upload  
@upload = Upload.find(params[:id])  
send\_file(@upload.file,  
:filename =\> @upload.name,  
:type =\> @upload.content\_type,  
:disposition =\> “inline”)  
end

Form

**Upload a file:**  
 \<% form\_tag({:action =\> 'create'}, :multipart =\> true) do %\> \<%= file\_field("upload", "upload") %\>\<%= submit\_tag("Upload file") %\> \<% end %\>

Thanks for any help.  
Lynn
