'你没有选择要上传的文件'codeigniter

I am trying to upload an image via codeigniter but constantly recieve the following message: 'You did not select a file to upload'.

I have viewed many SO answers on this but nothing has helped:

  • PHP config max File upload size: 2M (I tested with 0.5mb files)
  • Form is multipart
  • Website is on localhost

HTML:

<h3>Upload profile image</h3>
    <div data-role="fieldcontainer">
        <form action='do_upload_prof' method='post' enctype="multipart/form-data">
        <input type="file" name='file'>
        <input type='submit' value='upload' />
        </form>
    </div>

PHP Controller:

public function do_upload_prof() { 
    $config = array(
        'upload_path' => "./profile_img/",
        'allowed_types' => "gif|jpg|png|jpeg",
        'overwrite' => TRUE,
        'max_size' => "4048000", 
        'max_height' => "768",
        'max_width' => "1024"
    );
    $this->load->library('upload', $config);
    if ($this->upload->do_upload('file')) {
        $data = array(
            'upload_data' => $this->upload->data()
        );
        $this->load->view('header');
        $this->load->view('profile', $data);
        $this->load->view('footer');
    } else {
        $error = array(
            'error' => $this->upload->display_errors()
        );
        $this->load->view('header');
        $this->load->view('profile', $error);
        $this->load->view('footer');
    }
}