我尝试实现文件上传时遇到此错误。
if ($request->isPost()) {
$form->setInputFilter($language->getInputFilter());
$nonFile = $request->getPost()->toArray();
$File = $this->params()->fromFiles('fileupload');
$data = array_merge(
$nonFile, array('fileupload' => $File['name'])
);
$form->setData($request->getPost());
if ($form->isValid()) {
$size = new Size(array('min' => 20));
$adapter = new \Zend\File\Transfer\Adapter\Http();
$adapter->setValidators(array($size), $File['name']);
if (!$adapter->isValid()) {
$dataError = $adapter->getMessages();
$error = array();
foreach ($dataError as $key => $row) {
$error[] = $row;
} //set formElementErrors
$form->setMessages(array('fileupload' => $error));
} else {
$adapter->setDestination(dirname(__DIR__) . '/module/Application/Lanuguage');
if ($adapter->receive($File['name'])) {
$data = $form->getData();
$language->populate($data);
$this->getEntityManager()->persist($language);
$this->getEntityManager()->flush();
echo ' upload ' . $language->fileupload;
}
}
return $this->redirect()->toRoute('admin_language');
}
}
现在当我为$ dataError获取转储时。我收到此消息
数组([fileUploadErrorIniSize] =>文件''超出定义的ini大小)
我正在尝试上传85字节大小的文件。我的php.ini中的默认文件上传大小是8M。