繁体   English   中英

Codeigniter上传类的问题

[英]problems with codeigniter upload class

我在do_upload函数的我的Upload-Controller中加载了上传库:

public function do_upload() {
    $upload_path_url = base_url() . 'uploads/';
    $config['upload_path'] = FCPATH . 'uploads/';
    $config['allowed_types'] = 'jpg|jpeg|png|gif';
    $config['max_size'] = '30000';

    // Here i loaded the library
    $this->load->library('upload', $config);

        // Here is the undefined $upload variable
        if (!$this->upload->do_upload()) {
        // code
        }
    // code
    }

我收到此错误:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Upload::$upload

Filename: controllers/Upload.php

Line Number: 24

Backtrace:

File: /var/www/application/controllers/Upload.php
Line: 24
Function: _exception_handler

File: /var/www/index.php
Line: 274
Function: require_once

我该如何解决这个问题?

请提及您要从中上传文件的输入名称,如下所示:

// Here is the undefined $upload variable
        if (!$this->upload->do_upload('input_name')) { // here you have to mention input name
        // code
        }

我认为这应该为您工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM