CodeIgniter Forums
Mysterious upload error, do_upload function doesn't exist? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Mysterious upload error, do_upload function doesn't exist? (/thread-6501.html)



Mysterious upload error, do_upload function doesn't exist? - El Forum - 03-01-2008

[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!


Mysterious upload error, do_upload function doesn't exist? - El Forum - 03-01-2008

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

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



Mysterious upload error, do_upload function doesn't exist? - El Forum - 03-01-2008

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