无法以codeigniter文本格式上传文件

I have a text form that works and I have a file uploading form that works using the exact example from the codeigniter docs, but I don't seem to be able to put the two together.

I want a form that allows text and file upload. The text should go to the database and the file to storage with filepath saved in the DB.

The Form you need:

<?php echo form_open_multipart('upload/do_upload');?>
   Text: <input type="text" name="usertext" size="20" />
   <br /><br />
   File: <input type="file" name="userfile" size="20" />
   <br /><br />
   <input type="submit" value="upload" />
<?php echo form_close();?>

in upload controller:

function do_upload()
{
    $config['upload_path'] = './uploads/';
    $config['allowed_types'] = 'gif|jpg|png';
    $config['max_size'] = '100';
    $config['max_width']  = '1024';
    $config['max_height']  = '768';
    $this->load->library('upload', $config);
    if ( ! $this->upload->do_upload('userfile'))
    {
        $error = array('error' => $this->upload->display_errors());
        // upload error area
    }
    else
    {
        $data = array('upload_data' => $this->upload->data());
        //upload success area

        $userfile = $upload_data['file_name']; // the uploaded file name

        $usertext = $this->input->post('usertext'); // the text from form

        // Here you can insert the value of $usertext to db

    }
}