interface UploadedFileInterface (View source)

Provides an interface for uploaded files.

Methods

string
getClientOriginalName()

Returns the original file name.

bool
isValid()

Returns whether the file was uploaded successfully.

string
getErrorMessage()

Returns an informative upload error message.

int
getError()

Returns the upload error code.

int
getSize()

Gets file size.

string|false
getRealPath()

Gets the absolute path to the file.

string
getPathname()

Gets the path to the file.

string
getFilename()

Gets the filename.

Details

string getClientOriginalName()

Returns the original file name.

The file name is extracted from the request that uploaded the file and as such should not be considered a safe value.

Return Value

string

The original file name supplied by the client.

bool isValid()

Returns whether the file was uploaded successfully.

Return Value

bool

TRUE if the file has been uploaded with HTTP and no error occurred.

string getErrorMessage()

Returns an informative upload error message.

Return Value

string

The error message regarding a failed upload.

int getError()

Returns the upload error code.

If the upload was successful, the constant UPLOAD_ERR_OK is returned. Otherwise, one of the other UPLOAD_ERR_XXX constants is returned.

Return Value

int

The upload error code.

int getSize()

Gets file size.

Return Value

int

The filesize in bytes.

See also

https://www.php.net/manual/en/splfileinfo.getsize.php

string|false getRealPath()

Gets the absolute path to the file.

Return Value

string|false

The path to the file, or FALSE if the file does not exist.

See also

https://php.net/manual/en/splfileinfo.getrealpath.php

string getPathname()

Gets the path to the file.

Return Value

string

The path to the file.

See also

https://php.net/manual/en/splfileinfo.getpathname.php

string getFilename()

Gets the filename.

Return Value

string

The filename.

See also

https://php.net/manual/en/splfileinfo.getfilename.php