struct Athena::Framework::UploadedFile
inherits Athena::Framework::AbstractFile
#
Represents a file uploaded to the server. Exposes related information from the client request. See the Getting Started docs for more information.
Methods#
#client_mime_type : String
#
Returns the file's MIME type as determined by the client. It should not be considered as a safe value.
For a trusted MIME type, use #mime_type (which guesses the MIME type based on the file's contents).
#client_original_extension : String
#
Returns the original extension of the file as determined by the client.
#client_original_name : String
#
Returns the original name of the file as determined by the client. It should not be considered a safe value to use for a file on your server.
#client_original_path : String
#
Returns the original full file path as determined by the client. It should not be considered a safe value to use for a file name/path on your server.
If the file was uploaded with the webkitdirectory
directive, this will contain the path of the file relative to the uploaded root directory.
Otherwise will be identical to #client_original_name
.
#error_message : String
#
Returns an informational message as to why the upload failed.
Note
Return value is only valid when the uploaded file's #status
is NOT Status::OK
.
#guess_client_extension : String | ::Nil
#
Returns the extension based on the client MIME type, or nil
if the MIME type is unknown.
This method uses #client_mime_type
, and as such should not be trusted.
For a trusted extension, use #guess_extension
which guesses the extension based on the guessed MIME type for the file).
#move(directory : Path | String, name : String | Nil = nil) : Athena::Framework::File
#
Moves this file to the provided directory, optionally with the provided name. If no name is provided, its current #basename will be used.
#status : Athena::Framework::UploadedFile::Status
#
Returns the status of this uploaded file.
#valid? : Bool
#
Returns true
if this file was successfully uploaded via HTTP, otherwise returns true
.