I want to upload image through this but i cant able to upload image .i don't know where is my mistake but browser giving 404 and 500 error.
1st error:- Failed to load resource: the server responded with a status of 404 (Not Found) 2nd error :- /index.php/insert/iexpert:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
XHR failed loading: POST "".
XHR failed loading: POST "http://*******.myuideveloper.com/index.php/insert/iexpert".
 <form id="myForm" action="" method="post"  accept-charset="utf-8" >
                                            <div class="form-group">
                                              <input type="file" class="form-control" name="eimage" id="eimage" placeholder="Choose image" required>
                                              </div>
                                               <div class="form-group">
                                                <input type="text" class="form-control" name="ename" id="ename" placeholder="Employee Name" required>
                                              </div>
                                              <div class="form-group">
                                               <input type="text" class="form-control" id="epost" name="epost" placeholder="Designation" required>
                                              </div>
                                              <div class="form-group">
                                               <input type="email" class="form-control" id="email" name="email" placeholder="Email" required>
                                              </div>
                                                <div class="form-group">
                                                <input type="hidden" name="jid" value="jid"/>
                                               <input type="submit" name="action" value="Add" class="form-control btn btn-success"/> 
                                    </form>
ajax:-
     $(document).on('submit','#myForm',function(e)
    {
            e.preventDefault();
            var ename=$('#ename').val();
            var epost=$('#epost').val();
            var email=$('#email').val();
            var pwd=$('#pwd').val();
            var extension=$('#eimage').val().split('.').pop().toLowerCase();
            if(jQuery.inArray(extension,['gif','png','jpg','jpeg'])==-1)
                {   
                    alert('invalid file');
                    $('#eimage').val();
                    return false;
                }
            if(ename !='' && epost !='' && email !=''&& pwd !='' )   
            {
                $.ajax({
                    url:"<?php echo site_url(); ?>/insert/iexpert", 
                    method:'post',
                    data:new FormData(this),
                    contentType:false,
                    processData:false,
                    cache:false,
                    success:function(data)
                    {
                        alert(data);
                        $('#myForm')[0].reset();
                        $('#myModel').modal('hide');
                         showalljobs();
                    }
                });
            }
            else
            {
                alert('fill all field');
            }
          });
controller :-
    public function iexpert()
        {   
            if(isset($_FILES['eimage']['name']))
            {
            $config['upload_path']='./upload/';
                        $config['allowed_types']='jpg|jepg|png|gif';
                        $this->upload->initialize($config);
                        if(! $this->upload->do_upload('eimage'))
                        { echo $
        this->upload->display_errors();}
                    else
                    {
                        $data=$this->upload->data();
                        $insert_data=array( 
                        'eimage' => $data['file_name'],
                        'ename' => $this->input->post('ename'),
                        'epost' => $this->input->post('epost'),
                        'email' => $this->input->post('email'),
                        'edate'=>$now   );
                     $result=$this->insert_m->iexpert($insert_data);
                        echo " data inserted";  
                    }
                }
                else
                {echo "file not found";}
            }
    model
    public function iexpert($data)
            {
            $this->db->insert('expert',$data);
            }
