title: how to update form that contains filefield without re-upload the file again in Yii?
body: <p>I want to update a record in my model, and it contains a file field, here is the form code:</p>
  
  <pre><code>&lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'img'); ?&gt;
          &lt;?php echo CHtml::activeFileField($model,'img',array('width'=&gt;25,'lentgh'=&gt;25)); ?&gt;
          &lt;?php echo $form-&gt;error($model,'img'); ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and here is the update action in the controller:</p>
  
  <pre><code>$model=$this-&gt;loadModel($id);
  
  $img = $model-&gt;img;
  
          if(isset($_POST['Press']))
          {
  
              $model-&gt;attributes=$_POST['Press'];
              $model-&gt;img = $img;
  
              if(isset($_POST['Press']['img'])){
                 if(!empty ($_POST['Press']['img']))        
                    $model-&gt;img = CUploadedFile::getInstance($model, 'img');
  </code></pre>
  
  <p>So if the user didn't upload an image, the value of img attribute should not be updated and the model should be validated, but I got validation error every time I click on save and the img file filed is empty, so how I can fix this issue ?  </p>