Module ActionController::UploadedFile
In: vendor/rails/actionpack/lib/action_controller/request.rb

Methods

Public Class methods

[Source]

     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 696
696:     def self.included(base)
697:       base.class_eval do
698:         attr_accessor :original_path, :content_type
699:         alias_method :local_path, :path
700:       end
701:     end

Public Instance methods

Take the basename of the upload‘s original filename. This handles the full Windows paths given by Internet Explorer (and perhaps other broken user agents) without affecting those which give the lone filename. The Windows regexp is adapted from Perl‘s File::Basename.

[Source]

     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 708
708:     def original_filename
709:       unless defined? @original_filename
710:         @original_filename =
711:           unless original_path.blank?
712:             if original_path =~ /^(?:.*[:\\\/])?(.*)/m
713:               $1
714:             else
715:               File.basename original_path
716:             end
717:           end
718:       end
719:       @original_filename
720:     end

[Validate]