Topic: Uploading pdf
i am trying to upload the pdf. i can select the file but unable to upload
here is my model
class DataFile < ActiveRecord::Base
name = upload['datafile'].original_filename
directory = "public/data"
# create the file path
path = File.join(directory, name)
# write the file
File.open(path, 'w') do |f|
here is my controller
class UploadController < ApplicationController
render :file => 'app\views\upload\uploadfile.html.erb'
post = DataFile.Save(upload)
render :text => "File has been uploaded successfully"
Last edited by kiran kumar cy (2012-09-12 06:28:30)