upload a file - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: upload a file (/showthread.php?tid=76200) |
upload a file - kris2 - 04-21-2020 Hello I need help to know how to updload an image. I find example but nothing works either it is codeigniter 3 or it does not work for me I created a form with <input type="file" name="acimage" /> On my controller I have ... $file = $this->request->getFile('acimage'); if (! $file->isValid()) { throw new RuntimeException($file->getErrorString().'('.$file->getError().')'); } On the line if (! $file->isValid()) I have the same kind of error Call to a member function isValid() on null same kind of error with $file->getName(); not easy to write simple in black. Sorry Is this page https://makitweb.com/how-to-upload-file-in-codeigniter/ Still valid with codeigniter 4 RE: upload a file - kris2 - 04-21-2020 I found a solution I changed in my view form_open by form_open_multipart This is not very well explained in the example. They supposed to be obvious. |