2009年2月24日星期二

[fw-mvc] Multiple file upload issues

I'm working off the latest version in the trunk, and I'm having some issues with multiple file uploads with Zend_Form_Element_File

Consider the following:

        $form = new Zend_Form();
$element = new Zend_Form_Element_File('pictures');
$element->setDestination(realpath(APP_ROOT . '/temp'))
        ->setIsArray(true)
        ->setMultiFile(2);
        
        $form->addElement($element);
$form->setAttrib('enctype', 'multipart/form-data');
$form->addElement('submit', 'Submit');
if ($this->getRequest()->isPost()) {
if ($form->isValid($_POST)) {
print_r($form->getElement('pictures')->getValue()); 
}
}

The first file uploads fine but the second gives me a warning that looks something like this: Warning: move_uploaded_file(Array\{filename})
For some reason its setting to the destination directory for the second file to an array for some reason.

没有评论: