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
<div id="UploadFileBox">
<b>Upload a file:<br/></b>
<% form_tag({:action => ''create''}, :multipart =>
true) do %>
<%= file_field("upload", "upload") %><%=
submit_tag("Upload file") %>
<% end %>
Thanks for any help.
Lynn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---