## iPhorm_Validator_FileUpload

Description

FileUpload Validator

Located in /iPhorm/Validator/FileUpload.php (line 10)

    iPhorm_Validator_Abstract
       |
       --iPhorm_Validator_FileUpload

Variable Summary
array $_allowedExtensions
int|float $_maximumFileSize
string $_name
boolean $_required
int $_requiredCount
Method Summary
iPhorm_Validator_FileUpload __construct (string|array $options)
array getAllowedExtensions ()
int|float getMaximumFileSize ()
string getName ()
boolean getRequired ()
int getRequiredCount ()
boolean isValid (string $value)
void setAllowedExtensions ( $allowedExtensions)
void setMaximumFileSize (int|float $maximumFileSize)
void setName (string $name)
void setRequired ([boolean $flag = true])
void setRequiredCount (int $count)
string _getFileUploadError (int $errorCode, [string $filename = ''])
Variables
array $_allowedExtensions = array() (line 24)

Allowed file extensions

- access: protected

int|float $_maximumFileSize = 10485760 (line 33)

Maximum file size in bytes

Default is 10MB (10485760 bytes)

- access: protected

string $_name (line 17)

The name of the element to check in the $_FILES array

- access: protected

boolean $_required = false (line 40)

Required flag

- access: protected

int $_requiredCount = 0 (line 47)

How many files are required for a multiple upload element, 0 = all

- access: protected

#### Inherited Variables

Inherited from iPhorm_Validator_Abstract

> iPhorm_Validator_Abstract::$_messages

Methods
Constructor __construct (line 57)

Class constructor

A string with the name of the element or an array of options with a name key is required

- access: public

iPhorm_Validator_FileUpload __construct (string|array $options)

- string|array $options

getAllowedExtensions (line 222)

Get the allowed extensions

- access: public

array getAllowedExtensions ()
getMaximumFileSize (line 242)

Get the maximum file size in bytes

- access: public

int|float getMaximumFileSize ()
getName (line 196)

Get the name of the element

- access: public

string getName ()
getRequired (line 262)

Get whether the file is required or not

- access: public

boolean getRequired ()
getRequiredCount (line 282)

Get the count for required files for a multiple upload field

- access: public

int getRequiredCount ()
isValid (line 87)

Returns true if and only if the uploaded file is free of errors

- access: public

boolean isValid (string $value)

- string $value

setAllowedExtensions (line 208)

Set the allowed extensions, an array of lowercase extensions e.g. array('jpg', 'jpeg', 'gif'). An empty array means all file extensions are allowed

- access: public

void setAllowedExtensions ( $allowedExtensions)

- array $allowedExtensions

setMaximumFileSize (line 232)

Set the maximum file size in bytes

- access: public

void setMaximumFileSize (int|float $maximumFileSize)

- int|float $maximumFileSize

setName (line 186)

Set the name of the element to validate in $_FILES

- access: public

void setName (string $name)

- string $name

setRequired (line 252)

Set whether the file is required or not

- access: public

void setRequired ([boolean $flag = true])

- boolean $flag

setRequiredCount (line 272)

Set the count for required files for a multiple upload field

- access: public

void setRequiredCount (int $count)

- int $count

_getFileUploadError (line 295)

Get the error message corresponding to the error code generated by PHP file uploads and this validator

- return: The error message
- access: protected

string _getFileUploadError (int $errorCode, [string $filename = ''])

- int $errorCode: The error code
- string $filename: (optional) The filename to add to the message

#### Inherited Methods

Inherited From iPhorm_Validator_Abstract

> iPhorm_Validator_Abstract::addMessage()
> iPhorm_Validator_Abstract::getMessages()

Documentation generated on Thu, 24 Feb 2011 22:19:37 +0000 by phpDocumentor 1.4.3