HTML_QuickForm2
[ class tree: HTML_QuickForm2 ] [ index: HTML_QuickForm2 ] [ all elements ]

Class: HTML_QuickForm2_Rule_MaxFileSize

Source Location: /HTML_QuickForm2-0.2.0/QuickForm2/Rule/MaxFileSize.php

Class Overview

HTML_QuickForm2_Rule
   |
   --HTML_QuickForm2_Rule_MaxFileSize

Rule checking that uploaded file size does not exceed the given limit


Author(s):

Version:

  • Release: 0.2.0

Methods


Inherited Variables

Inherited Methods

Class: HTML_QuickForm2_Rule

HTML_QuickForm2_Rule::__construct()
Class constructor
HTML_QuickForm2_Rule::and_()
Adds a rule to the chain with an "and" operator
HTML_QuickForm2_Rule::checkValue()
Validates the element's value
HTML_QuickForm2_Rule::getMessage()
Returns the error message output by the rule
HTML_QuickForm2_Rule::getOptions()
Returns the rule's configuration data
HTML_QuickForm2_Rule::or_()
Adds a rule to the chain with an "or" operator
HTML_QuickForm2_Rule::setMessage()
Sets the error message output by the rule
HTML_QuickForm2_Rule::setOptions()
Sets additional configuration data for the rule
HTML_QuickForm2_Rule::setOwner()
Sets the element that will be validated by this rule
HTML_QuickForm2_Rule::validate()
Performs validation

Class Details

[line 67]
Rule checking that uploaded file size does not exceed the given limit

The Rule needs one configuration parameter for its work: the size limit. This limit can be passed either to setOptions() or to HTML_QuickForm2_Factory::registerRule(). Limit registered with the Factory overrides one set for the particular Rule instance via setOptions().

Note that if file upload failed due to upload_max_filesize php.ini setting or MAX_FILE_SIZE form field, then this rule won't even be called, due to File element's built-in validation setting the error message.

The Rule considers missing file uploads (UPLOAD_ERR_NO_FILE) valid.



[ Top ]


Method Detail

checkValue   [line 76]

bool checkValue( $value)

Validates the element's value
  • Return: whether uploaded file's size is within given limit
  • Throws: HTML_QuickForm2_InvalidArgumentException if a bogus $registeredType was passed to constructor or a bogus size limit was provided
  • Access: protected

Overrides HTML_QuickForm2_Rule::checkValue() (Validates the element's value)

Parameters:

   $value   — 

[ Top ]

setOwner   [line 107]

void setOwner( HTML_QuickForm2_Node $owner)

Sets the element that will be validated by this rule
  • Throws: HTML_QuickForm2_InvalidArgumentException if trying to use this Rule on something that isn't a file upload field
  • Access: public

Overrides HTML_QuickForm2_Rule::setOwner() (Sets the element that will be validated by this rule)

Parameters:

HTML_QuickForm2_Element_InputFile   $owner   —  File upload field to validate

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:10:21 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.