Cfilevalidator Use For Not Uploaded File

I have a lot of images. I should to valid them. But the images are on the local file system. How can I valid them without CUploadedFile::getInstance?

I tried to do this:

$_FILES['temp_path']['tmp_name'] = '/home/user/1.jpg';

$_FILES['temp_path']['name'] = '1.jpg';

$_FILES['temp_path']['type'] = 'image/jpeg';

$_FILES['temp_path']['size'] = '545458';

$_FILES['temp_path']['error'] = 0;

$model->attribute = CUploadedFile::getInstance($model, "temp_path");

But I have got an error Missing argument 2 for CActiveRecord::setAttribute().

Hi just add on model rule function and set scenario like


 array('image_name', 'file', 'types' => 'jpg, jpeg, gif,  png','on'=>'create','minSize'=>559631,'tooLarge'=>'The file was  larger than 559631K. Please upload a smaller file.'),

array('image_name', 'file', 'allowEmpty' => TRUE,'types' => 'jpg, jpeg, gif, png','on'=>'update'),

I hope it’s some help

Unfortunately it does not work. 2nd rule in example requires ‘Temp Path cannot be blank.’

attribute invoke setAttribute function that has 2 arguments (name and value)

are you seek attributes instead attribute ?

Also CUploadedFile::getInstance returns a CUploadedFile object, so you can’t pass masive attributes directly

What exactly are you trying to do?