用户
 找回密码
 入住 CI 中国社区
搜索
查看: 197|回复: 0
收起左侧

[上传/下载] 图片上传报错有bug,调用upload后do_upload找不到对象

[复制链接]
发表于 2018-12-15 17:09:28 | 显示全部楼层 |阅读模式
报错
A PHP Error was encountered
Severity: Notice

Message: Undefined property: Admin:upload

Filename: admin/admin.php

Line Number: 60


Fatal error: Call to a member function do_upload() on a non-object in D:\phpStudy\PHPTutorial\WWW\ci\application\controllers\admin\admin.php on line 60




代码
$config['upload_path'] = './uploads/';
                $config['allowed_types'] = 'gif|jpg|jpeg|png';
                $config['max_size'] = 10000;
                $config['file_name'] = time() . mt_rand(1000,9999);
                //载入上传的类
                $this->load->library('upload', $config);
                //$this->upload->initialize($config);
                //接收图片
                $status = $this->upload->do_upload('imgs');
                //if(!$status){
                //        echo 'x';exit;
                //}
                //$wrong = $this->upload->display_errors();
                //if(!$wrong){
                //        echo 'x';exit;
                //}





本版积分规则