title: CakePHP file upload on 000webhost
body: <p>I am trying to get my app to be able to handle uploads. This is the add action in DealsController.php. </p>
  
  <pre><code>&lt;?php
          public function add() {
          if ($this-&gt;request-&gt;is('post')) {
              $this-&gt;request-&gt;data['Deal']['user_id'] = $this-&gt;Auth-&gt;user('id');
              $this-&gt;Deal-&gt;create();
              if ($this-&gt;Deal-&gt;uploadFile($this-&gt;request-&gt;data['Deal']['pic'])){
                  $file = $this-&gt;request-&gt;data['Deal']['pic'];
                  $this-&gt;request-&gt;data['Deal']['pic'] = $this-&gt;request-&gt;data['Deal']['pic']['name'];
                  if ($this-&gt;Deal-&gt;save($this-&gt;request-&gt;data)) {
                      $this-&gt;Session-&gt;setFlash(__('Your deal has been saved. %s', h(serialize($file)) ));
                      return $this-&gt;redirect(array('action' =&gt; 'index'));
                  }
                  $this-&gt;Session-&gt;setFlash(__('Unable to add your deal. %s', h(serialize($file)) ));
                  return $this-&gt;redirect(array('action' =&gt; 'index'));
              }
              $this-&gt;Session-&gt;setFlash(__('Unable to upload the file. Please try again. %s', h(serialize($this-&gt;request-&gt;data['Deal']['pic']))));
          }
      }
  </code></pre>
  
  <p>The <code>uploadFile</code> function is defined in the model in Deal.php</p>
  
  <pre><code>&lt;?php
  public function uploadFile( $check ) {
  
      $uploadData = array_shift($check);
  
      if ( $uploadData['size'] == 0 || $uploadData['error'] !== 0) {
          return false;
      }
  
      $uploadFolder = 'files'. DS .'your_directory';
      $fileName = time() . '.pdf';
      $uploadPath =  $uploadFolder . DS . $fileName;
  
      if( !file_exists($uploadFolder) ){
          mkdir($uploadFolder);
      }
  
      if (move_uploaded_file($uploadData['tmp_name'], $uploadPath)) {
          $this-&gt;set('pic', $fileName);
          return true;
      }
  
      return false;
  }
  
  `uploadFile` keeps returning false and I get my 
  </code></pre>
  
  <blockquote>
    <p>Unable to upload the file. Please try again.
    a:5:{s:4:"name";s:7:"012.PDF";s:4:"type";s:15:"application/pdf";s:8:"tmp_name";s:14:"/tmp/phpw0uVGS";s:5:"error";i:0;s:4:"size";i:70118;}</p>
  </blockquote>
  
  <p>flash. Which is confusing, since it makes it look like the file was actually uploaded to a temp dir. I tried different paths for <code>move_uploaded_file</code> but nothing worked. Does this have something to do with file permissions? It couldn't be file-size, since my upload file was only about 80 KB.</p>