title: Using CakePHP to create file upload, all $file array entries return single first character of filename
body: <p>Using the following code in my view file (add.ctp):</p>
  
  <pre><code>&lt;div class="resources form"&gt;
  &lt;?php echo $this-&gt;Form-&gt;create('Resource');?&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;&lt;?php __('Add Resource'); ?&gt;&lt;/legend&gt;
      &lt;?php
          echo $this-&gt;Form-&gt;input('title');
          echo $this-&gt;Form-&gt;input('file', array('type' =&gt; 'file'));
          ...
      ?&gt;
  &lt;/fieldset&gt;
  &lt;?php echo $this-&gt;Form-&gt;end(__('Submit', true));?&gt;
  &lt;/div&gt;
  ...
  </code></pre>
  
  <p>...and the following code in the controller...</p>
  
  <pre><code>function add() {
      if (!empty($this-&gt;data)) {
          $this-&gt;Resource-&gt;create();
          if ($this-&gt;uploadFile() &amp;&amp; $this-&gt;Resource-&gt;save($this-&gt;data)) {
              $this-&gt;Session-&gt;setFlash(__('The resource has been saved', true));
              $this-&gt;redirect(array('action' =&gt; 'index'));
          } else {
              $this-&gt;Session-&gt;setFlash(__('The resource could not be saved. Please, try again.', true));
          }
      }
      ....
  }
  </code></pre>
  
  <p>...with the following function to test the process:</p>
  
  <pre><code>function uploadFile() {
          $file=$this-&gt;data['Resource']['file'];
          $this-&gt;data['Resource']['filename'] = 'failing with name:'.$file['name'].'/ file_mime: '.$file['filemime'];
      return true;
  }
  </code></pre>
  
  <p>The database is always populated with the first character of the files original filename, regardless of what file I try to upload or what elements of the $file array I try to access. For example with test.gif I get:</p>
  
  <p>"failing with name:t/ file_mime: t"</p>
  
  <p>Worthy of note, this code is the result of me reducing the tasks the function was to perform down to the barest minimum to locate the problem. Hence the weirdness of the result. The database column for the filename is established like this:</p>
  
  <p>filename/varchar(200)/utf8_general_ci/NOT NULL</p>
  
  <p>I'm new to CakePHP and am at a total loss of what to look for to make this work, tearing my hair out. Any help or pointing in the right direction to look would be gratefully received.</p>