title: How can I insert image name in database in cakephp?
body: <p>So far I have implemented is done below.</p>
  
  <p>The problem that I am facing is i cannot update the file name and as a result I am getting an error, resulting the file from not being upload.</p>
  
  <p>Controller:</p>
  
  <pre><code>public function add(){ 
      if (!empty($this-&gt;data)) {  
          if (!empty($this-&gt;data['Note'])){  
              $filename = basename($this-&gt;data['Note']['note_image']['name']); 
              move_uploaded_file($this-&gt;data['Note']['note_image']['tmp_name'],WWW_ROOT . 'files' . DS . $filename); 
  
              if($this-&gt;Note-&gt;save($this-&gt;data['Note'])){  
                  $this-&gt;Session-&gt;setFlash('The note has been saved');
                  $this-&gt;redirect(array('action' =&gt; 'add'));
              }           
          }  
      }
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;?php
  echo $this-&gt;Form-&gt;create('Note', array('type' =&gt; 'file'));
  echo $this-&gt;Form-&gt;input('note_title');
  echo $this-&gt;Form-&gt;input('note_desc');
  echo $this-&gt;Form-&gt;input('note_image', array('type' =&gt; 'file'));
  echo $this-&gt;Form-&gt;end('Add');
  ?&gt;
  </code></pre>
  
  <p>I think save function will not be there. Is there a way to do it.</p>