title: Yii framework, uploading files doesn't work
body: <p>I have a form and I want to upload a file. here is my code:</p>
  
  <pre><code>&lt;div class="form"&gt;
  
  &lt;?php $form=$this-&gt;beginWidget('CActiveForm', array(
     'id'=&gt;'show-form',
     'enableAjaxValidation'=&gt;false,
         'htmlOptions' =&gt; array('enctype' =&gt; 'multipart/form-data'),
  
  )); ?&gt;
  
  &lt;fieldset&gt;
      &lt;legend&gt;DATI TECNICI&lt;/legend&gt;
  
          &lt;div class="row"&gt;
             &lt;?php echo $form-&gt;labelEx($model,'tec_data_file'); ?&gt;
             &lt;?php echo $form-&gt;fileField($model,'tec_data_file',array('size'=&gt;45,'maxlength'=&gt;45)); ?&gt;
             &lt;?php echo $form-&gt;error($model,'tec_data_file'); ?&gt;
          &lt;/div&gt;
  &lt;/fieldset&gt;
  &lt;?php $this-&gt;endWidget(); ?&gt;
  
  &lt;/div&gt;&lt;!-- form --&gt;
  </code></pre>
  
  <p>There was nothing added to the database after submitting, I did a bit of debuging with firebug and figured out that <code>filefield</code> generates a code like this:</p>
  
  <pre><code>&lt;input id="ytShow_tec_data_file" type="hidden" name="Show[tec_data_file]" value=""&gt;
  &lt;input id="Show_tec_data_file" type="file" name="Show[tec_data_file]" maxlength="45" size="45"&gt;
  </code></pre>
  
  <p>and two data are sent by <code>$_POST</code> for <code>tec_data_file</code> (which is my file field in db). The first var is empty (I think it is related to first hidden input). and the second one contains my file. and when I'm assigning the variables to my model for saving:</p>
  
  <pre><code>$modelPhoto-&gt;attributes = $_POST['Photo'];
  </code></pre>
  
  <p>the <code>tec_data_file</code> gets an empty string! So nothing gets uploaded to my db. Anyone have an idea how to solve this? If you need more i</p>