Using PhpTumb in yii

i am using My link





public function actionCreate()

	{

		$model=new Pages;


		// Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);


		if(isset($_POST['Pages']))

		{

						

			$model->attributes=$_POST['Pages'];

			

			$picture_file = CUploadedFile::getInstance($model,'page_img');

						

			print_r( $picture_file);

						

			

			$model->page_name = $picture_file;

			if($model->save())

			$tmpPicture = Yii::app()->getBasePath() .'/tmp/' . $picture_file;

			$picture_file->saveAs($tmpPicture);

			$thumbFactory = PhpThumbFactory::create($tmpPicture);

			$thumbFactory->resize(182)

        ->cropFromCenter(182,89)

        ->save(Yii::getPathOfAlias('webroot.images.properties.182x89') .'/'.

        $picture_file);

				$this->redirect(array('view','id'=>$model->id));

		}


		$this->render('create',array(

			'model'=>$model,

		));

	}






When I try to create I am getting


 I am getting Fatal error: Call to a member function saveAs() on a non-object in

because picture file is null