[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>
<input type="file" size="20" name="image" />
</td></tr>
<tr><td colspan="2" align="center">
<input type="submit" name="submit" value="Submit" />
</td></tr>
</table>
<? echo form_close(); ?>
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!