"呼吁成员的功能库()上null"时使用的图书馆上载笨4

0

的问题

当我上载我的文件,我得到了错误就像这个"呼吁成员的功能库()上null"...为什么?

这是我的观点

<div class="modal-body">
        <div class="form-group">
            <label>File PDF</label>
            <form method="post" id="form-upload" action="<?= base_url(); ?>/panduan/testing" enctype="multipart/form-data">
            <input type="hidden" name="type_proses" id="type_proses" />
            <input type="hidden" name="type_file" id="type_file" />
            <input type="file" name="file" class="form-control" id="file" required accept=".pdf" /></p>
        </div>
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
    <button type="submit" class="btn btn-primary">Save</button>
  </div>
  </form>

这是我的控制

public function testing()
{
    $file_name = 'tes';
    $config['upload_path'] = FCPATH.'/public/assets-menu/file/upload/panduan/';
    $config['file_name'] = $file_name;
    $config['allowed_types'] = 'pdf';

    $this->load->library('upload', $config);
    if (!$this->upload->do_upload('file')) {
        print_r('error');
    } else {
        $data = $this->upload->data();
        print_r('ok');       
    }
}

我的构造

public function __construct()
{
    $this->panduan_model = new \App\Models\M_Panduan();
}
codeigniter codeigniter-4 file-upload
2021-11-23 18:37:22
1

最好的答案

0

我不知道,也许你错过这个线建造

public function __construct()
{
parent::__construct(); //don't forget this line
$this->panduan_model = new \App\Models\M_Panduan();
}
2021-11-23 19:40:51

谢谢你们,我已经试过,它不工作,在结束我用php动()
Sami Aji

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................