I try to add a validator for the length of the filename which is uploaded from my Zend form.
I don't know whether I should add this validator in the form itself or to the Zend_File_Transfer_Adapter_Http
handling the upload. However, right now I'm trying the second thing - see code below. I want the controller to redirect with an error flag if the length of the filename to be uploaded exceeds 40 chars.
$upload
results in being valid even with a 41 chars long filename - why?
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidators(
array(
array('validator' => 'StringLength', 'options' => array(
'min' => 0,
'max' => 40))
)
);
if (!$upload->isValid()) {
$this->_redirect('/customer/uploadfile/groupid/'.$groupId.'/flag/XXX-TODO-Failure');
}