Methods
Public Class methods
[ show source ]
# File lib/action_controller/request.rb, line 729
729: def self.included(base)
730: base.class_eval do
731: attr_accessor :original_path, :content_type
732: alias_method :local_path, :path
733: end
734: 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.
[ show source ]
# File lib/action_controller/request.rb, line 741
741: def original_filename
742: unless defined? @original_filename
743: @original_filename =
744: unless original_path.blank?
745: if original_path =~ /^(?:.*[:\\\/])?(.*)/m
746: $1
747: else
748: File.basename original_path
749: end
750: end
751: end
752: @original_filename
753: end