Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.6.2
-
Component/s: Zend_File_Transfer
-
Labels:None
Description
I created a form with a File element which is set to not required
After submitting the form i received Validation Error "File '' not found"
In Zend_File_Abstract on line ~580
if ($this->_options['ignoreNoFile'] and (isset($fileerrors['fileUploadErrorNoFile']))) {
unset($fileerrors['fileUploadErrorNoFile']);
}
Here it is still continuing to validate;
After changing this to
if ($this->_options['ignoreNoFile'] and (isset($fileerrors['fileUploadErrorNoFile']))) {
unset($fileerrors['fileUploadErrorNoFile']);
break;
}
Validation was working as expected.
I didnt find where to add a new Comment so i am editing this issue. I am using the Zf trunk.
class Form_Profile extends Cms_Form
{
public function init()
}
Cms_Form is extending the Zend_Dojo_Form
Language is just an ini file where i am keeping my messages and config is also ini
In the controller i am using
if ($this->_request->isPost()) {
$formData = $this->_request->getPost();
if ($form->isValid($formData)) { // here i am getting the message "File '' not found"
.... processing the data
if($form->UploadLogo->receive()) {
.... saving the file to database changing the name etc....
}
}
}
file not found is comiing as a validation message after submitting and not uploading a file
Added setRequired(false);
$UploadLogo->setDestination($this->CONFIG->paths->company_logo)
->addValidator('Count', false, 1) // ensure only 1 file
->addValidator('Size', false, 102400) // limit to 100K
->addValidator('Extension', false, $this->CONFIG->images->allowed_images)
->setRequired(false);
After calling isValid receiving the Validation Message "File '' not found";
The ignoreNoFile option is set on the Adapter as expected but it is continuing to Validate and assigning error messages in the Zend_File_Adapter_Abstract
Issue Links
| This issue is duplicated by: | ||||
| ZF-4386 | Issue with ignoreNoFile in Zend_File_Transfer_Adapter_Abstract |
|
|
|
ignoreNoFile does not work for ZF 1.6
Please give code for reproduction