document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. class ItemController extends CController
  2. {
  3.     public function actionCreate()
  4.     {
  5.         $model=new Item;
  6.         if(isset($_POST[\'Item\']))
  7.         {
  8.             $model->attributes=$_POST[\'Item\'];
  9.             $model->image=CUploadedFile::getInstance($model,\'image\');
  10.             if($model->save())
  11.             {
  12.                 $model->image->saveAs(\'path/to/localFile\');
  13.                 // redirect to success page
  14.             }
  15.         }
  16.         $this->render(\'create\', array(\'model\'=>$model));
  17.     }
  18. }
');