Reputation: 79
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);
}
Upvotes: 0
Views: 485
Reputation: 17735
1 Use Validation
not Validate
2. Pass the file name as first argument
$validation = Validation::factory($_FILES)->rule('image', 'Upload::not_empty');
if ($validation->check())
{
// Your code
}
Upvotes: 1