As noted by users, the validators from Zend_File_Transfer
do not work in conjunction with Zend_Config due to the fact
that they have not used named arrays.
Therefor, all filters and validators for Zend_File_Transfer
have been reworked. While the old signatures continue to work,
they have been marked as deprecated, and will emit a PHP notice
asking you to fix them.
The following list shows you the changes you will have to do for proper usage of the parameters.
Old method API:
Zend_Filter_File_Rename($oldfile, $newfile, $overwrite)New method API:
Zend_Filter_File_Rename($options)where$optionsaccepts the following array keys: source equals to$oldfile, target equals to$newfile, overwrite equals to$overwrite.
Example 1059. Changes for the rename filter from 1.6 to 1.7
// Example for 1.6
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addFilter('Rename',
array('/path/to/oldfile', '/path/to/newfile', true));
// Same example for 1.7
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addFilter('Rename',
array('source' => '/path/to/oldfile',
'target' => '/path/to/newfile',
'overwrite' => true));
Old method API:
Zend_Validate_File_Count($min, $max)New method API:
Zend_Validate_File_Count($options)where$optionsaccepts the following array keys: min equals to$min, max equals to$max.
Example 1060. Changes for the count validator from 1.6 to 1.7
// Example for 1.6
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Count',
array(2, 3));
// Same example for 1.7
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Count',
false,
array('min' => 2,
'max' => 3));
Old method API:
Zend_Validate_File_Extension($extension, $case)New method API:
Zend_Validate_File_Extension($options)where$optionsaccepts the following array keys: * equals to$extensionand can have any other key, case equals to$case.
Example 1061. Changes for the extension validator from 1.6 to 1.7
// Example for 1.6
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Extension',
array('jpg,gif,bmp', true));
// Same example for 1.7
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Extension',
false,
array('extension1' => 'jpg,gif,bmp',
'case' => true));
Old method API:
Zend_Validate_File_FilesSize($min, $max, $bytestring)New method API:
Zend_Validate_File_FilesSize($options)where$optionsaccepts the following array keys: min equals to$min, max equals to$max, bytestring equals to$bytestring.
Additionally, the useByteString() method
signature has changed. It can only be used to test if the
validator is expecting to use byte strings in generated
messages. To set the value of the flag, use the
setUseByteString() method.
Example 1062. Changes for the filessize validator from 1.6 to 1.7
// Example for 1.6
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('FilesSize',
array(100, 10000, true));
// Same example for 1.7
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('FilesSize',
false,
array('min' => 100,
'max' => 10000,
'bytestring' => true));
// Example for 1.6
$upload->useByteString(true); // set flag
// Same example for 1.7
$upload->setUseByteSting(true); // set flag
Old method API:
Zend_Validate_File_Hash($hash, $algorithm)New method API:
Zend_Validate_File_Hash($options)where$optionsaccepts the following array keys: * equals to$hashand can have any other key, algorithm equals to$algorithm.
Example 1063. Changes for the hash validator from 1.6 to 1.7
// Example for 1.6
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Hash',
array('12345', 'md5'));
// Same example for 1.7
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Hash',
false,
array('hash1' => '12345',
'algorithm' => 'md5'));
Old method API:
Zend_Validate_File_ImageSize($minwidth, $minheight, $maxwidth, $maxheight)New method API:
Zend_Validate_File_FilesSize($options)where$optionsaccepts the following array keys: minwidth equals to$minwidth, maxwidth equals to$maxwidth, minheight equals to$minheight, maxheight equals to$maxheight.
Example 1064. Changes for the imagesize validator from 1.6 to 1.7
// Example for 1.6
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('ImageSize',
array(10, 10, 100, 100));
// Same example for 1.7
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('ImageSize',
false,
array('minwidth' => 10,
'minheight' => 10,
'maxwidth' => 100,
'maxheight' => 100));
Old method API:
Zend_Validate_File_Size($min, $max, $bytestring)New method API:
Zend_Validate_File_Size($options)where$optionsaccepts the following array keys: min equals to$min, max equals to$max, bytestring equals to$bytestring.
Example 1065. Changes for the size validator from 1.6 to 1.7
// Example for 1.6
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Size',
array(100, 10000, true));
// Same example for 1.7
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Size',
false,
array('min' => 100,
'max' => 10000,
'bytestring' => true));




