[eluser]silent_assassin[/eluser]
I m trying to write a simple program that uploads an image to a directory.when i press submit button i get following error message.
Quote:Fatal error: Call to undefined method CI_Upload::insert() in C:\wamp\www\code\system\application\models\post_data.php on line 11
This is my model
Code:
<?php
class Post_data extends Model
{
function insert()
{
$config=array('upload_path'=>'./uploads/',
'allowed_types'=>'png|gif|JPG|JPEG|PNG|GIF',
'max_size'=>'1000');
$this->load->library('upload',$config);
$this->upload->insert();
}
}
?>
This is my controller
Code:
<?php
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
}
function index()
{
$this->load->model('post_data');
$this->load->view('post_view.html');
if($this->input->post('create_product'))
{
$this->post_data->insert();
}
}
}
and finally my view
Code:
<html>
<head></head>
<body>
<?php $this->load->helper('form'); ?>
<?php echo form_open_multipart('Welcome'); ?>
<?php echo form_upload();?>
<p>
<?php echo form_submit('create_product', 'Upload image'); ?>
</p>
<?php echo form_close(); ?>
</body>
</html>
How to overcome this error?