Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save neilime/4493255 to your computer and use it in GitHub Desktop.
Save neilime/4493255 to your computer and use it in GitHub Desktop.
$form = new \Zend\Form\Form();
$form->add(array(
'name' => 'test_file_input',
'type' => 'Zend\Form\Element\File'
));
$inputFilter = new \Zend\InputFilter\InputFilter();
$inputFilter->add(array(
'name' => 'test_file_input',
'required' => true,
'validators' => array(
array(
'name' => 'File\Extension',
'options' => array('extension' => 'mo')
)
)
));
$form->setInputFilter($inputFilter);
//Fake datas for test
$_FILES = array(
'test_file_input' => array(
'name' => 'testsize.mo',
'type' => 'text',
'size' => 200,
'tmp_name' => __DIR__ . '/_files/testsize.mo',
'error' => 0
)
);
$form->setData($validDatas)
$form->isValid(); // Error : stream_resolve_include_path() expects parameter 1 to be string, array given
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment