Upload problem when updating a form

hi,

I have a model that contain uploaded images, the upload works fine.

I use the CGridView widget to display the content of the model.

now if want to update one of those records i get the field that containt the name of the image empty !

this is my controller code that contain creating and updating records




	public function actionCreate()

	{

		$model=new News;


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

		{


			$model=new News;

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

			$model->news_img=CUploadedFile::getInstance($model,'news_img');

			if(!is_null($model->news_img ))

				{

					

					$model->news_img->saveAs("../contenuto/news/".$model->news_img);

				}

				else

				

					$model->news_img = $model->_defaultImg;




			if($model->save())

			{

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

			}

		}

		


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

			'model'=>$model,

		));

	}


	/**

	 * Updates a particular model.

	 * If update is successful, the browser will be redirected to the 'view' page.

	 * @param integer $id the ID of the model to be updated

	 */

	public function actionUpdate($id)

	{

		$model=$this->loadModel($id);


		// Uncomment the following line if AJAX validation is needed

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

		//exit ($model->news_img);

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

		{

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

			

			$model->news_img=CUploadedFile::getInstance($model,'news_img');

			if($_FILES['news_img'] )

			{

				$model->news_img =$_FILES['News[news_img]']['name'];

				$model->news_img->saveAs("../contenuto/news/".$model->news_img);

			}

			

			

			


			if($model->save())

			{

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

				

			}

		}


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

			'model'=>$model,

		));

	}






As i told you create work fine.

I make a test for $_FILES but i still get an exception :


PHP Error

Description

Undefined index: news_img


I don’t know what is the name of the form that genetate CActiveForm to know where is the name of the file in the $_FILES

i hope you help me because i’m stuck in this problem