validating the file size:
In the model, in the rules functions add this line
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array(
'yourfile',
'file',
'types'=>'jpg, gif, png, jpeg',
'maxSize'=>1024 * 1024 * 50,
'tooLarge'=>'File has to be smaller than 50MB'
),
.....
.....
.....
);
}