title: October CMS extend System/Models/File
body: <p>I trying to keep original file name when using System/Models/File, I got following code to extend this model:</p>
  
  <pre><code>    namespace System\Models;
  class NewFile extends File { public function fromPost($uploadedFile) { if ($uploadedFile === null) { return; }
  
    $this-&gt;file_name = $uploadedFile-&gt;getClientOriginalName();
    $this-&gt;file_size = $uploadedFile-&gt;getClientSize();
    $this-&gt;content_type = $uploadedFile-&gt;getMimeType();
    $this-&gt;disk_name = $this-&gt;getDiskName();
  
    /*
     * getRealPath() can be empty for some environments (IIS)
     */
    $realPath = empty(trim($uploadedFile-&gt;getRealPath()))
        ? $uploadedFile-&gt;getPath() . DIRECTORY_SEPARATOR . $uploadedFile-&gt;getFileName()
        : $uploadedFile-&gt;getRealPath();
  
    //$this-&gt;putFile($realPath, $this-&gt;disk_name);
    $this-&gt;putFile($realPath, $this-&gt;file_name);
  
    return $this;
  </code></pre>
  
  <p>It works with file itself, it keeps original name but problem is link to attached file is still being generated. Broke my mind but cant get this work. Can anyone elaborate how to fix it?</p>