0

I am trying to validate file, but I get following error: Illegal offset type in isset or empty . What I am doing wrong ?

$array = Validate::factory($_FILES);
             $array->rule($_FILES['image'], 'Upload::not_empty');

             if ($array->check())
             {
               $directory = DOCROOT.'uploads/';
               $filepath = Upload::save($_FILES['image'], 'SDFFasreixcsd.jpg', $directory);
             }
4

1 回答 1

1

1Validation不使用Validate
2. 将文件名作为第一个参数传递

$validation = Validation::factory($_FILES)->rule('image', 'Upload::not_empty');  
if ($validation->check())  
{  
       // Your code  
}
于 2013-01-29T08:40:14.963 回答