title: CakePHP 3 : Image upload from controller
body: <p>I am trying to uploading image from controller using PHP. Here image upload is working fine but content is not saving in database, only image path saving. If I comment on image upload code then content is add in database fine. </p>
  
  <p>Here is my code that I have tried </p>
  
  <pre><code>    &lt;?= $this-&gt;Form-&gt;create($news,array('type'=&gt;'file')) ?&gt;
               &lt;div class="col-md-12"&gt;
                  &lt;?php
                      echo $this-&gt;Form-&gt;input('newsImage',['type'=&gt;'file']);
                      echo $this-&gt;Form-&gt;input('title',['class'=&gt;'form-control']);
                      echo $this-&gt;Form-&gt;input('news');
                  ?&gt;
              &lt;/div&gt;
     &lt;?= $this-&gt;Form-&gt;end() ?&gt;
  </code></pre>
  
  <p>And in controller I have tried below code for upload image </p>
  
  <pre><code> if ($this-&gt;request-&gt;is('post')) {
  
                  $target_dir = "img/news/";
                  $target_file = $target_dir . basename($_FILES["newsImage"]["name"]);
  
                  $fNAME   = $_FILES["newsImage"]["name"];
                  $TMPNAME = $_FILES['newsImage']['tmp_name'];
  
                  move_uploaded_file($_FILES["newsImage"]["tmp_name"], $target_file);
  
  
                  $this-&gt;request-&gt;data['News']['newsImage']=$fNAME;
  
                  $news = $this-&gt;News-&gt;patchEntity($news, $this-&gt;request-&gt;data);
                  if ($this-&gt;News-&gt;save($news)) {
                      $this-&gt;Flash-&gt;success(__('The news has been saved.'));
                      //return $this-&gt;redirect($this-&gt;referer()); 
                      return $this-&gt;redirect(['action' =&gt; 'index']);
                  } else {
                      $this-&gt;Flash-&gt;error(__('The news could not be saved. Please, try again.'));
                  }
  }
  </code></pre>
  
  <p>Here only image directory saving in database, title and news not saving. </p>