i am trying to upload the files for that i have used the below code.when i try to upload i shows the error message that access denied for c/rails/.../dump please kindly help me controller: class DocumentsController < ApplicationController before_filter :login_required model :user after_filter OutputCompressionFilter def index new render :action => ''new'' end #GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :new, :update ], :redirect_to => { :action => :list } def cancel redirect_to :controller => ''account/welcome'' flash[:notice] = ''document not uploaded'' end def new if request.get? @document = Document.new else @document = Document.new(params[:document]) begin if @document.save flash[:notice] = ''document uploaded'' redirect_to :action => ''list'' end rescue logger.error("Error while saving document containing ''#{@document.filename}''") if File.unlink(@document.dump_filename) == 1 logger.error("Cleanup of ''#{@document.dump_filename}'' successful") else logger.error("Cleanup of ''#{@document.dump_filename}'' failed") end flash[:notice] = ''Internal error during upload.'' redirect_to :action => ''list'' end end end #def list #@document_pages, @document = paginate :document, :per_page => 10 #end def list @document = Document.find(:all, :order => ''uploaddate'') end #def view #@user = get_user #@pages = @user.pages #@page = @pages.find(params[:id]) #end def show @document = Document.find(params[:id]) end def edit @document = Document.find(params[:id]) end def update @document = Document.find(params[:id]) if @document.update_attributes(params[:document]) flash[:notice] = ''document was successfully updated.'' redirect_to :action => ''show'', :id => @document else render :action => ''edit'' end end def destroy @document = Document.find(params[:id]).destroy redirect_to :action => ''list'' end end model: class Document < ActiveRecord::Base attr_accessible :description, :file validates_presence_of :filename has_and_belongs_to_many :bundles, :uniq => true has_and_belongs_to_many :categories, :uniq => true def file=(file_field) @file = file_field original_filename = file_field.original_filename logger.info("Original filename is ''#{original_filename}''") self.filename = base_document_of(original_filename) logger.info("Sanitized filename is ''#{self.filename}''") # self.content_type = file_field.content_type.strip end def orginal_filename end def validate_on_create if @file.size <= 0 errors.add_to_base("File size is invalid") end end def before_create filename = dump_filename logger.info("Uploading file to ''#{filename}''") @file.rewind File.open(filename, "wb") do |f| f.write(@file.read) end end def dump_filename # DUMP_PATH is set in config/environment.rb File.expand_path(File.join(DUMP_PATH, "#{self.filename}")) end private def base_document_of(filename) filename = File.basename(filename.strip) # remove leading period, whitespace and \ / : * ? " '' < > | filename = filename.gsub(%r{^\.|[\s/\\\*\:\?''"<>\|]}, ''_'') end 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-/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 -~----------~----~----~----~------~----~------~--~---