I have a problem uploading image in a Codeigniter app I'm working on. The code was working when on my pc (ubuntu) just fine, as it's given in tutorials. But when I'm trying this in my (centos) server, it's giving an error
"You did not select a file to upload.".

Just for your reference, I'll paste the code here.

**Controller- Upload1.php** 

```
 <?php

 class Upload1 extends CI_Controller {

    function __construct()
    {
            parent::__construct();
            $this->load->helper(array('form', 'url'));
    }

    function index()
    {
            $this->load->view('upload_form1', array('error' => ' ' ));
    }

    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())
            {
                    $error = array('error' => $this->upload->display_errors());

                    $this->load->view('upload_form1', $error);
            }
            else
            {
                    $data = array('upload_data' => $this->upload->data());

                    $this->load->view('upload_success1', $data);
            }
    }
 }
 ?>

```

 **Form - upload\_form1.php** 

```
 <html>
 <head>
 <title>Upload Form</title>
 </head>
 <body>

 <?php echo $error;?>

 <?php echo form_open_multipart('upload1/do_upload');?>

 <input type="file" name="userfile" size="20" />

 <br /><br />

 <input type="submit" value="upload" />

 </form>

 </body>
 </html>

```

**Success Page- upload\_success1.php** 

```
 <html>
 <head>
 <title>Upload Form</title>
 </head>
 <body>

 <h3>Your file was successfully uploaded!</h3>

 <ul>
 <?php foreach ($upload_data as $item => $value):?>
 <li><?php echo $item;?>: <?php echo $value;?></li>
 <?php endforeach; ?>
 </ul>

 <p><?php echo anchor('upload1', 'Upload Another File!'); ?></p>

 </body>
 </html>

```

What could be the problem? 
I have "uploads" directory set to 777. So that's not likely to be the reason. I also tried couple of solutions to similar problems, but isn't working. Have missed something obvious?

Versions:
For Server- PHP 5.3.13 (cli) 
My PC- PHP 5.3.3 . 

Codeigniter is same on local and remote machines- that is 2.1.3

I will be grateful for your suggestions!!

Thank you so much