class ActionDispatch::Http::UploadedFile - actionpack-4.2.3 Documentation

# class ActionDispatch::Http::UploadedFile

Models uploaded files.

The actual file is accessible via the `tempfile` accessor, though some of its interface is available directly for convenience.

Uploaded files are temporary files whose lifespan is one request. When the object is finalized Ruby unlinks the file, so there is no need to clean them with a separate maintenance task.

### Attributes

content_type[RW]

A string with the MIME type of the file.

headers[RW]

A string with the headers of the multipart request.

original_filename[RW]

The basename of the file in the client.

tempfile[RW]

A `Tempfile` object with the actual uploaded file. Note that some of its interface is available directly.

to_io[RW]

A `Tempfile` object with the actual uploaded file. Note that some of its interface is available directly.

### Public Instance Methods

close(unlink_now=false) click to toggle source

Shortcut for `tempfile.close`.

    # File lib/action_dispatch/http/upload.rb, line 47
    def close(unlink_now=false)
      @tempfile.close(unlink_now)
    end

eof?() click to toggle source

Shortcut for `tempfile.eof?`.

    # File lib/action_dispatch/http/upload.rb, line 67
    def eof?
      @tempfile.eof?
    end

open() click to toggle source

Shortcut for `tempfile.open`.

    # File lib/action_dispatch/http/upload.rb, line 42
    def open
      @tempfile.open
    end

path() click to toggle source

Shortcut for `tempfile.path`.

    # File lib/action_dispatch/http/upload.rb, line 52
    def path
      @tempfile.path
    end

read(length=nil, buffer=nil) click to toggle source

Shortcut for `tempfile.read`.

    # File lib/action_dispatch/http/upload.rb, line 37
    def read(length=nil, buffer=nil)
      @tempfile.read(length, buffer)
    end

rewind() click to toggle source

Shortcut for `tempfile.rewind`.

    # File lib/action_dispatch/http/upload.rb, line 57
    def rewind
      @tempfile.rewind
    end

size() click to toggle source

Shortcut for `tempfile.size`.

    # File lib/action_dispatch/http/upload.rb, line 62
    def size
      @tempfile.size
    end