我正在使用下面的代码进行文件验证。奇怪的是,如果我尝试上传超过大小限制的文件,我得到的不是空错误,而是与大小限制相关的错误。谁能解释问题出在哪里?
$validate = Validate::factory($_FILES);
$validate->rules('image',
array(
'Upload::valid' => array(),
'Upload::not_empty' => array(),
'Upload::type' =>array('Upload::type' => array('jpg','png','gif')),
'Upload::size' => array('1M'))
);
if ($validate->check())
{
//ok
$directory = DOCROOT.'uploads/';
$filepath = Upload::save($_FILES['image'], '123zxhahaxdfdgsdfsdha.jpg', $directory);
Request::instance()->redirect($redirect);
}
else
{
//error
$this->errors = $validate->errors('errors');
$errors = $this->errors;
//echo $errors;
}