Struct params::File [] [src]

pub struct File {
    pub path: PathBuf,
    pub filename: Option<String>,
    pub size: u64,
    pub content_type: Mime,
}

An uploaded file that was received as part of multipart/form-data parsing.

Files are streamed to disk because they may not fit in memory.

Fields

The path to the temporary file where the data was saved.

The filename that was specified in the request, unfiltered.

Warning

This may or may not be legal on the local filesystem, and so you should not blindly append it to a Path, as such behavior could easily be exploited by a malicious client.

The size of the file, in bytes.

Get the MIME type (Content-Type value) of this file, if supplied by the client, or "applicaton/octet-stream" otherwise.

Warning

You should treat this value as untrustworthy because it can be spoofed by the client.

Methods

impl File
[src]

[src]

Attempts to open the file in read-only mode.

Trait Implementations

impl FromValue for File
[src]

Extracts from File variant.

[src]

Returns Some if the conversion was successful, None otherwise.

impl Clone for File
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for File
[src]

[src]

Formats the value using the given formatter.

impl PartialEq for File
[src]

Checks only for equality of the file's path.

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.