title: CakePHP, move_uploaded_file() does not work and I am not getting any errors
body: <p>I am trying to upload a file using <code>move_uploaded_file()</code> in CakePHP3.</p>
  
  <p>I have used a if statement to check what move_uploaded_file() is returning, and its false. I have attached my code but I think I am using the function correctly.</p>
  
  <p>My target location is <strong><em>webroot/img/work</em></strong>. </p>
  
  <p>I am not getting any errors. </p>
  
  <p>I have changed dir owner <code>sudo chown www-data:www-data work/</code></p>
  
  <p>I have changed dir permissions <code>sudo chmod 777 work/</code></p>
  
  <p>I am new to cakePHP so I don't know what else I could try.</p>
  
  <p>Here are my files:</p>
  
  <p><strong><em>src/Controller/WorkController.php</em></strong></p>
  
  <pre><code>    public function add()
      {
          // Get file to be uploaded.
          $file = $this-&gt;request-&gt;getData('image');
          // Set path to the upload location.
          $target = WWW_ROOT . 'img' . DS . 'work' . DS;
  
          $work = $this-&gt;Work-&gt;newEntity();
          if($this-&gt;request-&gt;is('post')) {
              $work = $this-&gt;Work-&gt;patchEntity($work, $this-&gt;request-&gt;getData());
              // Assign value.
              $work['image'] = $file['name'];
              // Move uploaded file.
              move_uploaded_file( $file['name'], $target );
              if($this-&gt;Work-&gt;save($work)) {
                  $this-&gt;Flash-&gt;success(__('New work item added!'));
                  return $this-&gt;redirect(['action' =&gt; 'index']);
              }
              $this-&gt;Flash-&gt;error(__('Unable to add new work item.'));
          }
          $this-&gt;set('work', $work );
  
      }
  </code></pre>
  
  <p><strong><em>src/Template/Work/add.ctp</em></strong></p>
  
  <pre><code>&lt;?php
      echo $this-&gt;Form-&gt;create($work, array( 'enctype' =&gt; 'multipart/form-data'));
      echo $this-&gt;Form-&gt;control('title');
      echo $this-&gt;Form-&gt;control('body', ['rows' =&gt; '5']);
      echo $this-&gt;Form-&gt;control('link');
      // echo $this-&gt;Form-&gt;control('image');
      echo $this-&gt;Form-&gt;control('image', array('type' =&gt; 'file'));
      echo $this-&gt;Form-&gt;button(__('Add Work'));
      echo $this-&gt;Form-&gt;end();
  ?&gt;
  </code></pre>