0
votes

i load the upload library in my Upload-Controller in the do_upload function:

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
    }

i get this error:

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

how i can solve the problem?

1
change $config['upload_path'] = $upload_path_url - Dexter
and $this->upload->do_upload('image'); - Dexter
doesn't work :( i don't understand the problem :/ - Evolutio

1 Answers

0
votes

Please mention name of input from which you are uploading file, like below:

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

I think this should work for you.