class FormUploadedFile implements UploadedFileInterface (View source)

Provides a bridge to Symfony UploadedFile.

Properties

protected UploadedFile $uploadedFile

The wrapped uploaded file.

Methods

__construct(UploadedFile $uploadedFile)

Creates a new FormUploadedFile.

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

__construct(UploadedFile $uploadedFile)

Creates a new FormUploadedFile.

Parameters

UploadedFile $uploadedFile

The wrapped Symfony uploaded file.

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.

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.

string getPathname()

Gets the path to the file.

Return Value

string

The path to the file.

string getFilename()

Gets the filename.

Return Value

string

The filename.