title: cakephp 3 form with file type not saving image data in database
body: <p>I am trying to upload image using cakephp 3. I tried it in cake 2.x, it worked fine there but not in cake 3.0. My image is uploaded but it is not getting saved in DB.</p>
  
  <p><strong>view</strong></p>
  
  <pre><code>&lt;div class="col-lg-8"&gt;
  &lt;div class="articles form large-9 medium-8 columns content"&gt;
      &lt;?= $this-&gt;Form-&gt;create($article,['type' =&gt; 'file']) ?&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;&lt;?= __('Add Article') ?&gt;&lt;/legend&gt;
          &lt;?php
          echo $this-&gt;Form-&gt;input('title', [ "class" =&gt; "form-control"]);
  
          echo $this-&gt;Form-&gt;input('body', [ "class" =&gt; "form-control"]);
  
          echo $this-&gt;Form-&gt;file('image',[ "class" =&gt; "form-control"]);
          ?&gt;
      &lt;/fieldset&gt;
      &lt;?= $this-&gt;Form-&gt;button(__('Submit'), ["class" =&gt; "btn btn-primary"]) ?&gt;
      &lt;?= $this-&gt;Form-&gt;end() ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public function add() {
      $article = $this-&gt;Articles-&gt;newEntity();
      if ($this-&gt;request-&gt;is('post')) {
          $filepath = getcwd() . '/uploads/' . $this-&gt;request-&gt;data['image']['name'];
          $filename = $this-&gt;request-&gt;data['image']['name'];
          $article = $this-&gt;Articles-&gt;patchEntity($article, $this-&gt;request-&gt;data);
          if ($this-&gt;Articles-&gt;save($article)) {                
              move_uploaded_file($this-&gt;request-&gt;data['image']['tmp_name'], $filepath);
              $this-&gt;Flash-&gt;success(__('The article has been saved.'));
              return $this-&gt;redirect(['action' =&gt; 'index']);
          } else {
              $this-&gt;Flash-&gt;error(__('The article could not be saved. Please, try again.'));
          }
      }
      $this-&gt;set(compact('article'));
      $this-&gt;set('_serialize', ['article']);
  }
  </code></pre>
  
  <p><strong>Model</strong></p>
  
  <pre><code>namespace App\Model\Table;
  
  use App\Model\Entity\Article;
  use Cake\ORM\Query;
  use Cake\ORM\RulesChecker;
  use Cake\ORM\Table;
  use Cake\Validation\Validator;
  </code></pre>
  
  <p>class ArticlesTable extends Table
  {<br>
      public function initialize(array $config)
      {
           parent::initialize($config);</p>
  
  <pre><code>    $this-&gt;table('articles');
      $this-&gt;displayField('title');
      $this-&gt;primaryKey('id');
  
      $this-&gt;addBehavior('Timestamp');
  
      $this-&gt;hasMany('Comments', [
          'foreignKey' =&gt; 'article_id'
  
      ]);
  }
  
  
  public function validationDefault(Validator $validator)
  {
      $validator
          -&gt;add('id', 'valid', ['rule' =&gt; 'numeric'])
          -&gt;allowEmpty('id', 'create');
  
      $validator
          -&gt;allowEmpty('title');
  
      $validator
          -&gt;allowEmpty('body');
  
      $validator
          -&gt;add('image', [
                      'fileSize' =&gt; [
                              'rule' =&gt; [
                                  'fileSize', '&lt;', '5MB'
                              ],
                              'message' =&gt; 'Please upload file smaller than 5MB'
                          ],
                      'mimeType' =&gt; [
                          'rule' =&gt; [
                              'mimeType', ['image/jpeg','image/png','image/jpg']
                          ],
                          'message' =&gt; 'Please upload only png images'
                      ]
                  ]
          )
          -&gt;requirePresence('image', 'create')
          -&gt;notEmpty('image');
      return $validator;
  }
  </code></pre>
  
  <p>}</p>