如何在 Zend Framework 2 中上传多个文件。我已经完成了这项工作。但是,我收到第二个文件的以下错误。
'first-filename' was illegally uploaded. This could be a possible attack.
供你参考,
$size = new Size(array('max' => 1048576));
$adapter= new \Zend\File\Transfer\Adapter\Http();
$File = $this->params()->fromFiles('logo');
$adapter->setValidators(array($size), $File['name']);
$FileName = '';
if (!$adapter->isValid()){
$dataError = $adapter->getMessages();
$error = array();
foreach($dataError as $key=>$row)
{
$error[] = $row;
}
} else {
$adapter->setDestination(path);
if ($adapter->receive($File['name'])) {
// manipulation
}
}
$logoFile = $this->params()->fromFiles('logo2');
$adapterLogo = new \Zend\File\Transfer\Adapter\Http();
$adapterLogo->setValidators(array($size), $logoFile['name']);
$logoFileName= '';
if (!$adapterLogo->isValid()){
$dataError = $adapterLogo->getMessages();
$error = array();
foreach($dataError as $key=>$row)
{
$error[] = $row;
}
} else {
$adapterLogo->setDestination(path2);
if ($adapterLogo->receive($logoFile['name'])) {
// manipulation
}
}
我该如何解决这个问题?为什么会出现这个错误?