Class Index [+]

Quicksearch

ActionDispatch::Http::UploadedFile

Public Class Methods

extended(object) click to toggle source
    # File lib/action_dispatch/http/upload.rb, line 6
 6:       def self.extended(object)
 7:         object.class_eval do
 8:           attr_accessor :original_path, :content_type
 9:           alias_method :local_path, :path if method_defined?(:path)
10:         end
11:       end

Public Instance Methods

original_filename() click to toggle source

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.

    # File lib/action_dispatch/http/upload.rb, line 18
18:       def original_filename
19:         unless defined? @original_filename
20:           @original_filename =
21:             unless original_path.blank?
22:               if original_path =~ /^(?:.*[:\\\/])?(.*)/
23:                 $1
24:               else
25:                 File.basename original_path
26:               end
27:             end
28:         end
29:         @original_filename
30:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.