title: CodeIgniter 4 : Upload File
body: <p>I have a problem uploading a file in my form using CodeIgniter 4 and I can't find what's wrong. Can you help me, please? The name of the file is ok, the problem is that it doesn't move the file in the specified directory because I get this error: Call to a member function move() on null.
  WRITEPATH has the value: C:\xampp\htdocs\myproject\writable\</p>
  <p>The part of the view where I upload looks like this :</p>
  <pre><code>&lt;div class=&quot;card-body&quot;&gt;
      &lt;label for=&quot;exampleInputFile&quot;&gt;Fisier&lt;/label&gt;
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;div class=&quot;input-group&quot;&gt;
              &lt;div class=&quot;custom-file&quot;&gt;
                  &lt;input type=&quot;file&quot; class=&quot;custom-file-input&quot; name=&quot;customFile&quot; id=&quot;customFile&quot; required&gt;
                  &lt;label class=&quot;custom-file-label&quot; for=&quot;exampleInputFile&quot;&gt;Alege Fisierul&lt;/label&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>And the part of the controller function where I try to move the file in a specific folder looks like this :</p>
  <pre><code>$img = $this-&gt;request-&gt;getFile('customFile');
  $img-&gt;move(WRITEPATH . 'uploads');
  </code></pre>
  <p>I take the name of the file with this : <code>$this-&gt;request-&gt;getVar('customFile')</code></p>
  <p>Thank you !</p>