Issues

ZF-5090: $form->getValues() raises Warning when the form has Zend_Form_Element_File with setMultiFile

Issue Type: Bug Created: 2008-11-28T04:10:39.000+0000 Last Updated: 2008-12-21T05:08:05.000+0000 Status: Resolved Fix version(s): - 1.7.2 (23/Dec/08)

Reporter: twk (twk) Assignee: Thomas Weidner (thomas) Tags: - Zend_Form

Related issues: Attachments:

Description

The following code raises warning at the line of $form->getValues() and/or $element->getValue() whether or not when you upload files.

Warning: basename() expects parameter 1 to be string, array given in \your\library\Zend\Form\Element\File.php on line 600

I do not know the good workaround to get the file names.

setMultiFile(2) ->setDestination('d:\\temp') ; $form = new Zend\_Form; $form->setAttrib('enctype', 'multipart/form-data') // file upload ->setMethod('post') ->addElement($element, 'foo') ->addElement('submit', 'submit') ; if (isset($\_POST) && count($\_POST)) { echo 'valid = ', (int)$form->isValid($\_POST), "\\n"; if ($form->isValid($\_POST)) { echo 'value = ', print\_r($form->getValues(), true); // \*\*\*\* $form->foo->getValue() raises Warning, too } } $view = new Zend\_View(); echo $form->render($view); ### Comments Posted by twk (twk) on 2008-11-28T04:22:32.000+0000 As a workaround, you can use $this->getFileName() to get a file names array. Posted by Thomas Weidner (thomas) on 2008-11-28T11:30:33.000+0000 Fixed with r12938

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