Welcome Guest, Not a member yet? Register   Sign In
[solved] File Upload in CI4 does not work?
#1

(This post was last modified: 05-05-2020, 07:25 AM by niklas.)

Hello,

here is a short snipper from my project:

My View:
PHP Code:
<?= form_open('user/upload_logo'); ?>
                  <input type="file" name="userfile" />
                  <br><p class="text-right">
                  <input type="submit" class="btn btn-primary" value="upload">
                  </p>
<?= form_close(); ?>

And on the Controller's side:  (Just simple to check if getFiles() is working... )
PHP Code:
    public function upload_logo()
    {
        $files $this->request->getFiles();
        var_dump($files);
    }  

Result is

array(0) { }


Even if I use getFile('userfile') and try validate, move, store, etc. it always returns an error that I am calling a function on null.
So my file is getting lost while uploading Undecided

Anyone know how to fix this?

BR,
Niklas
Reply


Messages In This Thread
[solved] File Upload in CI4 does not work? - by niklas - 05-05-2020, 04:30 AM
RE: File Upload in CI4 does not work? - by niklas - 05-05-2020, 07:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB