Welcome Guest, Not a member yet? Register   Sign In
Mysterious upload error, do_upload function doesn't exist?
#1

[eluser]Unknown[/eluser]
Hi there,

I am trying to use the File Upload library to upload an image. But I get the following error when I try to load the page:

Quote:Fatal error: Call to undefined function do_upload()in /home/wyotrail/public_html/edit/igniter/application/controllers/images.php on line 134

I'm pretty sure I must be missing something simple.

The relevant code is as follows:

Controller

Code:
function _upload_image() {
    //upload file
    $config['upload_path'] = './uploads/';
    $config['allowed_types'] = 'gif|jpg|png';
    $config['max_size'] = '100';
    $config['max_width'] = '640';
    $config['max_height'] = '480';
        
    //load library for uploading files
    $this->load->library('upload', $config);
    
    if (!$this->upload>do_upload('image')) {    //this is the line causing errors
        $this->upload_error = $this->upload->display_errors();
        return false;
    }
    
    return true;
}

View:
Code:
<? echo form_open_multipart('images/add'); ?>
    <table border="0" cellpadding="3" cellspacing="0" align="center">
        <tr><td>
            Upload File:
        </td><td>
            &lt;input type="file" size="20" name="image" /&gt;
        </td></tr>    
        
        <tr><td colspan="2" align="center">
            &lt;input type="submit" name="submit" value="Submit" /&gt;
        </td></tr>
    </table>
&lt;? echo form_close(); ?&gt;

The add() function of my Image controller calls the _upload_image() function above upon submitting the form.

If anyone has an idea how to resolve this, please let me know. Thanks!
#2

[eluser]Seppo[/eluser]
Read carefully =)

Code:
$this->upload>do_upload('image')
// should be
$this->upload->do_upload('image')
#3

[eluser]Unknown[/eluser]
I knew it was going to be something stupid. Smile Thanks a lot though!




Theme © iAndrew 2016 - Forum software by © MyBB