title: CakePHP Change Data Before Saving to DB
body: <p>So I have the object $this->data['VideoForm']['filename'] in the controller, but I want to  append the return value of getExtension($filename) to it before I save it to the database. This is what I was trying:</p>
  
  <pre><code>$this-&gt;data['VideoForm']['filename'] = $this-&gt;data['VideoForm']['filename'] . "." . getExtension($this-&gt;data['VideoForm']['file']['name']);
  </code></pre>
  
  <p>It throws an error when I try to assign it a new value with the "=" or "=>" operator. Any idea of how to do it? I'm sure it's something very simple that I'm missing...</p>
  
  <p>EDIT: This is the error:</p>
  
  <pre><code>Notice (8): Indirect modification of overloaded property MediaController::$data has no effect [APP/Controller/MediaController.php, line 31]
  </code></pre>
  
  <p>EDIT: I've continued looking around, and the getExtension() function is definitely returning "jpg" if I upload xxx.jpg, so that's not the problem. Any ideas?</p>