Error in uploading file(help me urgnt)

when i tried to crate an upload file application in rails i am getting
error like this

Template is missing

Missing template app\views\upload\uploadfile.html.erb in view path
app/views

this is ma model

class DataFile < ActiveRecord::Base
def self.save(upload)
name = upload[‘datafile’].original_filename
directory = “public/data”
# create the file path
path = File.join(directory, name)
# write the file
File.open(path, “wb”) { |f| f.write(upload[‘datafile’].read) }
end
end

this is ma view file

File Upload

<%= start_form_tag ({:action => 'uploadFile'}, :multipart => true) %>

Select File : <%= file_field 'upload', 'datafile' %>

<%= submit_tag "Upload" %> <%= end_form_tag %>

This is ma controller

class UploadController < ApplicationController
def index
puts ‘hiiiiiiiiiii’
render :file => ‘app\views\upload\uploadfile.html.erb’
puts ‘hiiiiiiiiiii2’
end
def uploadFile
puts ‘hiiiiiiiiiii3’
post = DataFile.save(params[:upload])
render :text => “File has been uploaded successfully”
end
end

I think use render :file => ‘uploadfile.html.erb’, as rails would look
for
the template in your view directory, which is “app/views”,

and if you use render :file => ‘controller/uploadfile.html.erb’, it will
look for the template in “app/views/controller/uploadfile.html.erb”, or
rails always

assume you have already put your template in the controller’s according
view
folder

Yong Gu wrote:

I think use render :file => ‘uploadfile.html.erb’, as rails would look
for
the template in your view directory, which is “app/views”,

and if you use render :file => ‘controller/uploadfile.html.erb’, it will
look for the template in “app/views/controller/uploadfile.html.erb”, or
rails always

assume you have already put your template in the controller’s according
view
folder

wheen i did that i am getting the error like this

hiiiiiiiiiii3
SQL (0.5ms) SET client_min_messages TO ‘panic’
SQL (0.5ms) SET client_min_messages TO ‘notice’
SQL (0.6ms) SET client_encoding TO ‘unicode’

Processing UploadController#uploadFile (for 127.0.0.1 at 2010-03-29
11:47:28) [POST]
Parameters: {“commit”=>“Upload”,
“authenticity_token”=>“g1vUQZ7QAh7FjfusjbJuh7EBO4UVVFInaYsxzCMK91I=”,
“date_file”=>{“upload”=>#<File:/tmp/RackMultipart.3648.0>}}

NoMethodError (You have a nil object when you didn’t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]):

Did you add uploadFile to route.rb?

And i think you’d better follow rails’ convention, instead of writing
code
as like using some other frameworks

hi yong
i got the same proble and solved it ,

you can use in form tag uploadfile instead of uploadFile

and in render file : use #"{root_url}/app/view/–path"

hope you will solve it …
thanks

rahul