title: File upload using cakephp
body: <p>I just want to upload a single pdf file using cakephp,
  here is my view called <code>pdfadd.ctp</code>:</p>
  
  <pre><code>&lt;?php echo $this-&gt;Form-&gt;create('pdfadd1', array('enctype' =&gt; 'multipart/form-data'));?&gt;
      &lt;fieldset&gt;
      &lt;?php
          echo $this-&gt;Form-&gt;file('Document.submittedfile');
      ?&gt;
      &lt;/fieldset&gt;
  &lt;?php echo $this-&gt;Form-&gt;end(__('Submit'));?&gt;
  </code></pre>
  
  <p>Here is my conroller:</p>
  
  <pre><code> public function pdfadd(){
       if ($this-&gt;request-&gt;is('post') || $this-&gt;request-&gt;is('put')) {
           //die();
           $file = $this-&gt;request-&gt;data['Document']['submittedfile'];
           //$this-&gt;pdfadd1-&gt;save($this-&gt;request-&gt;data);
           move_uploaded_file($this-&gt;data['Document']['submittedfile']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . '/app/webroot/files/' . $this-&gt;data['Document']['submittedfile']['name']);
       }
  </code></pre>
  
  <p>It gives me this error:</p>
  
  <pre><code>Warning (2): move_uploaded_file(D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf): failed to open stream: No such file or directory [APP\Controller\PagesController.php, line 29]
  Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Program Files D\xampp\tmp\php862.tmp' to 'D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf' [APP\Controller\PagesController.php, line 29]
  </code></pre>
  
  <p>And also I want to rename the file to <code>1.pdf</code>. The file should save in <code>webroot/files</code>.</p>