Yii 1.0 Update Zip files

Update Zip Files Using PHP

I added the source code to add new file into existing zip files.

public function actionUpdatezip($zipfilename,$filelist)
{
    $destination=Yii::app()->basePath.'/files/'.$zipfilename.".zip";   
    $zip=new ZipArchive();
    if(!$zip->open($destination))
    {
        return false;
    }  
	
    if($filelist) 
    {                    
        foreach($filelist as $thefile)
        {                        
            $filemodel=new Filesmodle;   
            $randno=rand(11111,99999);                                        
            $filename=$randno.$thefile->name;   // yii magic method   
            $zip->addFile($thefile->tempname,$filename);                       
            //$fileext=$thefile->extensionName;
            //$filemodel->Size=$thefile->size;                                            
        }
    }
    $zip->close();    
}