Represents item values after file upload is initiated. Implements a magic toString method, so that any default rules or filter will not fail when applied to this value.

package Formagic\Item\Value
author Florian Sonnenburg
since 2013 First time introduced
codeCoverageIgnore Simple PoPo, not test-worthy

 Methods

Construct

__construct(string $fileName, string $mimeType, string $uploadedFilePath, integer $uploadError, integer $fileSize) 

Parameters

$fileName

string

$mimeType

string

$uploadedFilePath

string

$uploadError

integer

$fileSize

integer

Returns string representation if uploaded file.

__toString() : string

The return value of this method will be used e.g. in rules that are not capable of dealing explicitly with uploaded files but operate on string values (as indicated by the Formagic_Rule_Abstract::validate() method)

Returns

string

Returns the file name of the uploaded file.

getFileName() : string

Returns

stringFile name

Returns file size of the uploaded file in byte.

getFileSize() : integer

Returns

integerFile size in byte

Returns uploaded file's mime type

getMimeType() : string

Returns

string

Returns upload error status if a file is already uploaded.

getUploadStatus() : integer

Can one of the following PHP constant values:

  • UPLOAD_ERR_OK
  • UPLOAD_ERR_INI_SIZE
  • UPLOAD_ERR_FORM_SIZE
  • UPLOAD_ERR_PARTIAL
  • UPLOAD_ERR_NO_FILE
  • UPLOAD_ERR_NO_TMP_DIR
  • UPLOAD_ERR_CANT_WRITE
  • UPLOAD_ERR_EXTENSION
see for details

Returns

integerError status

 Properties

 

Original name of uploaded file

$fileName : string

Default

 

Size in byte of uploaded file

$fileSize : integer

Default

 

Mime type of uploaded file

$mimeType : string

Default

 

Upload status

$uploadStatus : integer

Default

 

Server path of uploaded file

$uploadedFilePath : string

Default