PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Zend_File_Transfer

Changes when using validators

As noted by users, the validators from Zend_File_Transfer do not work the same way like the default ones from Zend_Form. Zend_Form allows the usage of a $breakChainOnFailure parameter which breaks the validation for all further validators when an validation error has occurred.

So we added this parameter also to all existing validators from Zend_File_Transfer.

  • Old method API: addValidator($validator, $options, $files).

  • New method API: addValidator($validator, $breakChainOnFailure, $options, $files).

To migrate your scripts to the new API, simply add a FALSE after defining the wished validator.

Example 1091. How to change your file validators from 1.6.1 to 1.6.2

// Example for 1.6.1
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('FilesSize', array('1B', '100kB'));

// Same example for 1.6.2 and newer
// Note the added boolean false
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('FilesSize', false, array('1B', '100kB'));

Zend Framework