I am trying to upload the pdf using file io operations, i can select the file but when i click on the upload button it is not uploading the file here is my 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 upload_file = File.new(upload[''datafile''], ''r'').read File.open(path, ''w'') {|f| f.write(upload_file) } image = Magick::ImageList.new(''path.pdf'') images = Dir[''public/data/*.jpg''] imglist = Magick::ImageList.new imglist.read(*images) imglist.write(''name.pdf'') end end here is my controller class UploadController < ApplicationController def index render :file => ''app\views\upload\uploadfile.html.erb'' end def uploadFile DataFile.Save(params[:upload]) render :text => "File has been uploaded successfully" end end here is my view <h1>File Upload</h1> <%= form_tag :url=>{:controller=>"upload",:action => ''uploadFile''},:html=>{:multipart => true, :remote => true} do |f|%> <p><label for=''upload_file''>Select File</label> : <%= file_field ''upload'', ''datafile'' %></p> <%= submit_tag(''Upload'')%> <% end%> -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.