public function run()
 {
     // list of valid extensions, ex. array("jpeg", "xml", "bmp")
     $allowedExtensions = array("jpg");
     // max file size in bytes
     $sizeLimit = 1 * 1024 * 1024;
     $uploader = new qqFileUploader3($allowedExtensions, $sizeLimit);
     $result = $uploader->handleUpload('upload/');
     // to pass data through iframe you will need to encode all html tags
     $result = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
     echo $result;
 }
 public function actionAddbanner()
 {
     $model = $this->loadModel(Yii::app()->user->id);
     Yii::import("ext.Banner.qqFileUploader3");
     $folder = 'users/' . Yii::app()->user->id . '/';
     // folder for uploaded files
     $allowedExtensions = array("jpg", "jpeg", "gif", "png");
     //array("jpg","jpeg","gif","exe","mov" and etc...
     $sizeLimit = 8 * 1024 * 1024;
     // maximum file size in bytes
     $uploader = new qqFileUploader3($allowedExtensions, $sizeLimit);
     $result = $uploader->handleUpload($folder);
     $return = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
     $fileSize = filesize($folder . $result['filename']);
     //GETTING FILE SIZE
     $fileName = $result['filename'];
     //GETTING FILE NAME
     $ih = new CImageHandler();
     $ih->load($_SERVER['DOCUMENT_ROOT'] . '/users/' . Yii::app()->user->id . '/' . $fileName)->resize(1920, 436, false)->save($_SERVER['DOCUMENT_ROOT'] . '/users/' . Yii::app()->user->id . '/banner_' . $fileName);
     $model->top_banner = 'banner_' . $fileName;
     if ($model->save()) {
         //Yii::app()->user->photo = '100_'.$fileName;
         unlink($_SERVER['DOCUMENT_ROOT'] . '/users/' . Yii::app()->user->id . '/' . $fileName);
     }
     echo $return;
     // it's array
 }