Hi,
I used the following code to unzip some files:
private function _processZip($file) {
$zip=new ZipArchive;
if ($zip->open($file)===true) {
$zip->extractTo($this->unzippedDir);
$zip->close();
return true;
}
return false;
}
The goal is to scan the destination directory and validate each file.
Then I’ll store these validated files and auto-delete the non-validated ones.
Of course, i would like to reuse my file validation rule i setted up in the model:
public function rules() {
return array(array('title','file','on'=>'add','allowEmpty'=>false,'types'=>Yii::app()->params['allowedTypes'],'wrongType'=>'Wrong file type !','minSize'=>Yii::app()->params['minUploadSize'],'tooSmall'=>'File is too small !','maxSize'=>Yii::app()->params['maxUploadSize']),
...
is Yii able to do that ?
How i can access this rule ?