Issues

ZF-4634: Zend_Form_Element_File - setMultiFile does not work

Issue Type: Bug Created: 2008-10-18T07:25:00.000+0000 Last Updated: 2008-11-13T14:10:27.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Martin Hujer (mhujer) Assignee: Thomas Weidner (thomas) Tags: - Zend_Form

Related issues: Attachments:

Description

If I want to use setMultiFile, it does not work -> error message: The file 'upload_file' was illegal uploaded, possible attack.

I think, that the problem is with the $_FILES to files-array conversion.

$_FILES:

<pre class="highlight">
array(1) {
  ["upload_file"] => array(5) {
    ["name"] => array(2) {
      [0] => string(23) "zend_framework_logo.jpg"
      [1] => string(23) "zend_framework_logo.png"
    }
    ["type"] => array(2) {
      [0] => string(10) "image/jpeg"
      [1] => string(9) "image/png"
    }
    ["tmp_name"] => array(2) {
      [0] => string(23) "I:\xampp\tmp\php388.tmp"
      [1] => string(23) "I:\xampp\tmp\php389.tmp"
    }
    ["error"] => array(2) {
      [0] => int(0)
      [1] => int(0)
    }
    ["size"] => array(2) {
      [0] => int(4353)
      [1] => int(25524)
    }
  }
}

converted array:

<pre class="highlight">
array(1) {
  ["upload_file"] => array(2) {
    ["destination"] => string(30) "I:\xampp\htdocs\webexpo\upload"
    ["validators"] => array(0) {
    }
  }
}

Comments

Posted by Thomas Weidner (thomas) on 2008-10-18T07:46:38.000+0000

Please give reproducable code.

How the files are known internally has nothing to do with multifile. And the "converted array" does not show the internals of the file component.

Posted by Thomas Weidner (thomas) on 2008-10-21T14:57:09.000+0000

Probably fixed with r12068. If we get no response until 23.10 we will close this issue as fixed.

Posted by Martin Hujer (mhujer) on 2008-10-22T08:49:15.000+0000

Sorry, I didn't have time to reply earlier.

Problem happens when I have multifile element set as required.

Code for reproduction:

<pre class="highlight">
        $form = new Zend_Form();
        $form->setName('upload_form');
        $form->setMethod(Zend_Form::METHOD_POST);
        $form->setEnctype('multipart/form-data');

        $element = new Zend_Form_Element_File('upload_file');
        $element->setLabel('Upload:')->setRequired(true)
            ->setDestination('I:\xampp\htdocs\webexpo\upload');
        $element->setMultiFile(2);
        $form->addElement($element);
        
        $form->addElement(new Zend_Form_Element_Submit(array(
            'name' => 'Upload',
        )));

        $this->view->form = $form;
        
        if ($this->getRequest()->isPost()) {
            $valid = $form->isValid($this->getRequest()->getParams());
            echo $valid;
        }

Posted by Thomas Weidner (thomas) on 2008-10-22T12:20:29.000+0000

Solved with r12082.

Just to mention: There were also notices returned which have had helped in solving this issue faster. Background: addValidator was not able to handle multifiles.

Posted by Wil Sinclair (wil) on 2008-11-13T14:10:27.000+0000

Changing issues in preparation for the 1.7.0 release.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts