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