Class | Ramaze::Helper::Upload::UploadedFile
In: | lib/ramaze/helper/upload.rb
Parent: | Object

This class represents an uploaded file.

@author Lars Olsson @since 18-08-2011

### Methods

filename= new path save saved? unlink_tempfile

### Included Modules

Ramaze::Traited

### Attributes

filename | [R] | Suggested file name @return [String]
type | [R] | MIME-type @return [String]

### Public Class methods

new(filename, type, tempfile, options)

Initializes a new Ramaze::Helper::Upload::UploadedFile object.

@param [String] filename Suggested file name @param [String] type MIME-type @param [File] tempfile temporary file @param [Hash] options Options for uploaded files. Options supported

     match those available to
     Ramaze::Helper::Upload::ClassMethods#upload_options

@return [Ramaze::Helper::Upload::UploadedFile] A new

     Ramaze::Helper::Upload::UploadedFile object

@see save @see Ramaze::Helper::Upload::ClassMethods#upload_options

### Public Instance methods

filename=(name)

Changes the suggested filename of this Ramaze::Helper::Upload::UploadedFile. `name` should be a string representing the filename (only the filename, not a complete path), but if you provide a complete path this method it will try to identify the filename and use that instead.

@param [String] The new suggested filename.

path()

Returns the path of the Ramaze::Helper::Upload::UploadedFile object. The method will always return nil before save has been called on the Ramaze::Helper::Upload::UploadedFile object.

@return [String|nil]

save(path = nil, options = {})

Saves the Ramaze::Helper::Upload::UploadedFile.

If `path` is not set, the method checks whether there exists default options for the path and tries to use that instead.

If you need to override any options set in the controller (using upload_options) you can set the corresponding option in `options` to override the behavior for this particular Ramaze::Helper::Upload::UploadedFile object.

@param [String] path Path where the

     Ramaze::Helper::Upload::UploadedFile will be saved

@param [Hash] options Options for uploaded files. Options supported

     match those available to
     Ramaze::Helper::Upload::ClassMethods#upload_options

@raise [StandardError] Will be raised if the save operation fails. @see initialize @see Ramaze::Helper::Upload::ClassMethods#upload_options

saved?()

Returns whether the Ramaze::Helper::Upload::UploadedFile has been saved or not.

@return [Boolean]

unlink_tempfile()

Deletes the temporary file associated with this Ramaze::Helper::Upload::UploadedFile immediately.

[Validate]