title: Yii update case shows empty screen
body: <p>I have a form for editing a user record. Its updates the record for the first time but when i press the update button again, it shows me an empty screen and it unsets the picture as well. I cannot figure out what I am doign wrong
  Below is my code</p>
  
  <pre><code>public function actionEditProfile($affusername = NULL) {
  
      $this-&gt;layout = 'layout_home';
  
      if ($this-&gt;VarifyUser($affusername) &amp;&amp; Yii::app()-&gt;user-&gt;id) {
  
          $model = new Users('edit'); //apply rules if user comes directly to signup page
          // uncomment the following code to enable ajax-based validation
          if (isset($_POST['ajax']) &amp;&amp; $_POST['ajax'] === 'editprofile-form') {
              CActiveForm::validate($model);
              Yii::app()-&gt;end();
          }
  
          if (isset($_POST['Users'])) {
  
  
              $the_image = CUploadedFile::getInstance($model, 'image');
              if (is_object($the_image) &amp;&amp; get_class($the_image) === 'CUploadedFile') {
  
                  $model-&gt;image = $the_image;
              }
  
  
              if (is_object($the_image)) {
  
                  $file_name = Yii::app()-&gt;user-&gt;id . '.' . $model-&gt;image-&gt;extensionName;
  
                  $move = $model-&gt;image-&gt;saveAs(Yii::getPathOfAlias('webroot') . '/themes/myproject/images/users/' . $file_name);
  
                  $_POST['Users']['image'] = $file_name;
              }
  
  
              $model-&gt;attributes = $_POST['Users'];
  
  
              if ($model-&gt;validate()) {
  
                  // form inputs are valid, do something here
                  if ($model-&gt;updateByPk(Yii::app()-&gt;user-&gt;id, $_POST['Users'])) {
                      //$this-&gt;setFlashSuccess("Unable to register user, please try again");
                      $this-&gt;setFlashSuccess('Updated successfully, now redirecting.');
                      //$this-&gt;redirect($this-&gt;base_url);
                  } else {
                      $this-&gt;setFlashError("Unable to update user, please try again");
                      return false;
                  }
              } else {
                  print_r($model-&gt;getErrors());
                  echo 'validation  fail';
                  exit;
              }
          }
  
          $user_data = Users::model()-&gt;getUsersByUserName($affusername); //getting user information
          //print_r($user_data);
          //$model=new Users('nonfb-create'); //apply rules if user comes directly to signup page
          $this-&gt;render('editprofile', array('model' =&gt; $model, 'data' =&gt; $user_data,));
      } else {
          $this-&gt;redirect($this-&gt;base_url);
      }
  }
  </code></pre>
  
  <p>My view is</p>
  
  <pre><code>&lt;div class="adminform_wrapp"&gt;
      &lt;?php
      $form = $this-&gt;beginWidget('CActiveForm', array(
          'id' =&gt; 'editprofile-form',
          'enableAjaxValidation' =&gt; false,
          'clientOptions' =&gt; array(
              'validateOnSubmit' =&gt; true,
          ),
          'enableClientValidation' =&gt; true,
          'focus' =&gt; array($model, 'first_name'),
          'htmlOptions' =&gt; array(
              'enctype' =&gt; 'multipart/form-data'
          )
      ));
      echo $form-&gt;errorSummary($model);
      ?&gt;
  
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;label class="fieldname required" for="Users_First_Name"&gt;First Name: &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;?php echo $form-&gt;textField($model, 'first_name', array('value' =&gt; $data['first_name'])); ?&gt;
          &lt;?php $form-&gt;error($model, 'first_name'); ?&gt;
      &lt;/div&gt;
      &lt;!--adminform_row--&gt;
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;label class="fieldname required" for="Users_Last_Name"&gt;Last Name: &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;?php echo $form-&gt;textField($model, 'last_name', array('value' =&gt; $data['last_name'])); ?&gt;
          &lt;?php $form-&gt;error($model, 'last_name'); ?&gt;
      &lt;/div&gt;
      &lt;!--adminform_row--&gt;
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;label class="fieldname required" for="Users_Email"&gt;Email: &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;?php echo $form-&gt;textField($model, 'email', array('value' =&gt; $data['email'])); ?&gt;
          &lt;?php $form-&gt;error($model, 'email'); ?&gt;
      &lt;/div&gt;
      &lt;!--adminform_row--&gt;
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;label class="fieldname required" for="Users_Phone_No"&gt;Phone No: &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;?php echo $form-&gt;textField($model, 'phone_no', array('value' =&gt; $data['phone_no'])); ?&gt;
          &lt;?php $form-&gt;error($model, 'phone_no'); ?&gt;
      &lt;/div&gt;
      &lt;!--adminform_row--&gt;
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;label&gt;Username:&lt;/label&gt;
          &lt;span class="profile-username"&gt;&lt;?php echo $data['username']; ?&gt;&lt;/span&gt; &lt;/div&gt;
      &lt;!--adminform_row--&gt;
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;label&gt;Edit Profile picture:&lt;/label&gt;
          &lt;span class="image-placeholder"&gt;
              &lt;img src="&lt;?php echo $this-&gt;theme_baseurl . '/images/users/' . $data['image']; ?&gt;" style="width:96px; height:96px;"/&gt;
          &lt;/span&gt;
          &lt;div id='file_browse_wrapper'&gt;
  
              &lt;?php
              //echo $form-&gt;labelEx($model, 'image');
              echo $form-&gt;fileField($model, 'image', array('id' =&gt; 'file_browse'));
              echo $form-&gt;error($model, 'image');
              ?&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;!--adminform_row--&gt;
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;?php echo $form-&gt;labelEx($model, 'Address', array('class' =&gt; 'fieldname')); ?&gt;
          &lt;?php echo $form-&gt;textField($model, 'address', array('value' =&gt; $data['address'])); ?&gt;
          &lt;?php $form-&gt;error($model, 'address'); ?&gt;
      &lt;/div&gt;
      &lt;!--adminform_row--&gt;
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;label class="fieldname required" for="Users_Country"&gt;Country: &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;select class="error" onchange="print_state('Users_state', this.selectedIndex);" id="Users_country" name ="Users[country]"&gt;&lt;/select&gt;
          &lt;?php $form-&gt;error($model, 'country'); ?&gt;
      &lt;/div&gt;
      &lt;!--adminform_row--&gt;
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;label class="fieldname required" for="Users_State"&gt;State: &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;select name ="Users[state]" id ="Users_state"&gt;&lt;/select&gt;
          &lt;script language="javascript"&gt;print_state("Users_state", '', "&lt;?php echo $data['state'] ?&gt;");&lt;/script&gt;
          &lt;?php $form-&gt;error($model, 'state'); ?&gt;
      &lt;/div&gt;
      &lt;!--adminform_row--&gt;
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;label class="fieldname required" for="Users_City"&gt;City: &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;?php echo $form-&gt;textField($model, 'city', array('value' =&gt; $data['city'])); ?&gt;
          &lt;?php $form-&gt;error($model, 'city'); ?&gt;
      &lt;/div&gt;
      &lt;!--adminform_row--&gt;
  
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;label class="fieldname required" for="Users_Zipcode"&gt;Zipcode: &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;?php echo $form-&gt;textField($model, 'zipcode', array('value' =&gt; $data['zipcode'])); ?&gt;
          &lt;?php $form-&gt;error($model, 'zipcode'); ?&gt;
      &lt;/div&gt;
      &lt;!--adminform_row--&gt;
  
      &lt;!--adminform_row--&gt;
      &lt;div class="adminform_row"&gt;
          &lt;input type="submit" class="adminupdate_btn" value="Update"&gt;
          &lt;input type="reset" class="admincancel_btn" value="Cancel"&gt;
      &lt;/div&gt;
      &lt;!--adminform_row--&gt;
  
      &lt;?php $this-&gt;endWidget(); ?&gt;
  &lt;/div&gt;
  </code></pre>