ZF-4589: Zend_Form_Element_File has mixed error messages


When I have this form:

        $form = new Zend_Form();

        $element = new Zend_Form_Element_File('upload_file');
            ->addFilter(new Zend_Filter_File_Rename('XXX', 'XXX'))

        $element2 = new Zend_Form_Element_File('upload_file2');
            ->addFilter(new Zend_Filter_File_Rename('XXX', 'XXX'))
        $form->addElement(new Zend_Form_Element_Submit(array(
            'name' => 'Upload',

        $this->view->form = $form;
        if ($this->getRequest()->isPost()) {
            if (!$form->isValid($_POST)) {
                echo "Error";

And I submit it without choosing files, it should show the error message "The file 'upload_file' was not uploaded", but it shows "The file 'upload_file2' was not uploaded" by the first element.



Duplication of ZF-4411

Simply said: You can't set one part of your upload required and the other not. Eighter the uploaded files ARE required or they are not required. And this is the reason why your above example does not work as expected.

New feature for individual options added. Issue fixed with r12122

Changing issues in preparation for the 1.7.0 release.