Php 在CodeIgniter中上载图像和文件时出错

Php 在CodeIgniter中上载图像和文件时出错,php,codeigniter-3,Php,Codeigniter 3,我已经创建了一个员工登记表,但在图像上传和存储到图像文件夹中时出错,在文档文件上传时也出错。还有错误,比如 错误编号:1048 列“resume”不能为空 插入添加员工(照片,姓名,出生日期,入职日期,名称,资格,血型,入职前经验,入职后经验,总经验,永久地址,对应地址,sume,教育证书,经验证书,身份证明,地址证明,联系人,紧急联系人,紧急联系人)值(“‘xxx’、‘2021-04-10’、‘2021-04-10’、‘生产’、‘MCA’、‘O+ve’、‘4’、‘4’、‘asdfgh\r\n’

我已经创建了一个员工登记表,但在图像上传和存储到图像文件夹中时出错,在文档文件上传时也出错。还有错误,比如 错误编号:1048 列“resume”不能为空 插入
添加员工
照片
姓名
出生日期
入职日期
名称
资格
血型
入职前经验
入职后经验
总经验
永久地址
对应地址
sume
教育证书
经验证书
身份证明
地址证明
联系人
紧急联系人
紧急联系人
)值(“‘xxx’、‘2021-04-10’、‘2021-04-10’、‘生产’、‘MCA’、‘O+ve’、‘4’、‘4’、‘asdfgh\r\n’、‘hjghjfghdgfd’、‘ghfchhf\r\n’、NULL、NULL、NULL、NULL、NULL、NULL、‘6754321234’、‘6789557890’、‘xzxz’) 文件名:C:/xampp/htdocs/maheshfoundation/system/database/DB_driver.php 行号:691

我的视图文件
它清楚地表明resume列不能为null。要么传递一些值以resume,要么更改该列以接受null值。将resume column的默认值更改为null
<?php echo form_open_multipart('employee/store');?>
                                <div class="row">
                                    
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="photograph">Photograph</label>
                                            <input type="file" class="form-control" name="photograph" id="photograph" placeholder="Choose file" required>
                                            <small><?php echo form_error('photograph'); ?></small>
                                        </div>
                                    </div>  
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="name">Enter Name</label>
                                            <input type="text" class="form-control" name="name" id="name" placeholder="Enter Name" required>
                                            <small><?php echo form_error('name'); ?></small>
                                        </div>
                                    </div> 
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="date_of_birth">Date of Birth</label>
                                            <input type="date" class="form-control" name="date_of_birth" id="date_of_birth" placeholder="DOB" required>
                                            <small><?php echo form_error('date_of_birth'); ?></small>
                                        </div>
                                    </div> 
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="date_of_joining">Date of Joining</label>
                                            <input type="date" class="form-control" name="date_of_joining" id="date_of_joining" placeholder="DOJ" required>
                                            <small><?php echo form_error('date_of_joining'); ?></small>
                                        </div>
                                    </div>             
                                </div>

                                <div class="row">
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="designation">Designation</label>
                                            <select class="form-control" name="designation" id="designation" required>
                                                <option value="select">---Select---</option>
                                                <option value="Marketing">Marketing</option>
                                                <option value="Design">Design</option>
                                                <option value="Super Admin">Super Admin</option>
                                                <option value="Purchase">Purchase</option>
                                                <option value="Planning">Planning</option>
                                                <option value="Production">Production</option>
                                                <option value="Quality">Quality</option>
                                                <option value="Stores">Stores</option>
                                                <option value="Management">Management</option>
                                                <option value="HR">HR</option>
                                            </select>
                                            <small><?php echo form_error('designation'); ?></small>
                                        </div>
                                    </div>  
                            
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="qualification">Qualification</label>
                                            <input type="text" class="form-control" name="qualification" id="qualification" placeholder="Enter qualification" required>
                                            <small><?php echo form_error('qualification'); ?></small>
                                        </div>
                                    </div> 
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="Blood Group">Blood Group</label>
                                            <input type="text" class="form-control" name="Blood_Group" id="Blood_Group" placeholder="Enter Blood Group" required>
                                            <small><?php echo form_error('Blood_Group'); ?></small>
                                        </div>
                                    </div> 
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="exp_before_joining">Experience Before Joining</label>
                                            <input type="number" class="form-control" name="exp_before_joining" id="exp_before_joining" placeholder="Enter Experience Before Joining" required>
                                            <small><?php echo form_error('exp_before_joining'); ?></small>
                                        </div>
                                    </div>             
                                </div>


                                <div class="row">
                                    <div class="col-3">
                                        <div class="form-group">
                                        <label for="exp_after_joining">Experience After Joining</label>
                                            <input type="number" class="form-control" name="exp_after_joining" id="exp_after_joining" placeholder="Enter Experience After Joining" required>
                                            <small><?php echo form_error('exp_after_joining'); ?></small>
                                        </div>
                                    </div>  
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="total_exp">Total Experience</label>
                                            <input type="text" class="form-control" name="total_exp" id="total_exp" placeholder="Enter Total Experience" required>
                                            <small><?php echo form_error('total_exp'); ?></small>
                                        </div>
                                    </div> 
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="Permanent_Address">Permanent Address *</label>
                                            <textarea class="form-control" id="permanent_address" name="permanent_address" rows="4" cols="50" required> 
                                            </textarea>
                                            <small><?php echo form_error('permanent_address'); ?></small>                                       
                                            
                                        </div>
                                    </div> 
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="Correspondance_Address">Correspondance Address</label>
                                            <textarea class="form-control" id="correspondance_address" name="correspondance_address" rows="4" cols="50" required> 
                                            </textarea>
                                            <small><?php echo form_error('correspondance_address'); ?></small> 
                                        </div>
                                    </div>             
                                </div>

                                <div class="row">
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="resume">Resume</label>
                                            <input type="file" class="form-control" name="resume" id="resume" placeholder="Choose file" required>
                                            <small><?php echo form_error('resume'); ?></small>
                                        </div>
                                    </div>  
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="Education_Certificate">Education Certificate</label>
                                            <input type="file" class="form-control" name="education_certificate" id="education_certificate" placeholder="Enter Name" required>
                                            <small><?php echo form_error('education_certificate'); ?></small>
                                        </div>
                                    </div> 
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="Experience_Certificate">Experience Certificate</label>
                                            <input type="file" class="form-control" name="experience_certificate" id="experience_certificate" placeholder="DOB" required>
                                            <small><?php echo form_error('experience_certificate'); ?></small>
                                        </div>
                                    </div> 
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="id_proof">ID Proof *</label>
                                            <input type="file" class="form-control" name="id_proof" id="id_proof" placeholder="DOJ" required>
                                            <small><?php echo form_error('id_proof'); ?></small>
                                        </div>
                                    </div>             
                                </div>

                                <div class="row">
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="Address_Proof">Address Proof</label>
                                            <input type="file" class="form-control" name="address_proof" id="address_proof" placeholder="Choose file" required>
                                            <small><?php echo form_error('address_proof'); ?></small>
                                        </div>
                                    </div>  
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="contact">Permanent Contact Number *</label>
                                            <input type="text" class="form-control" name="contact" id="contact" placeholder="Enter Permanent Contact Number" required>
                                            <small><?php echo form_error('contact'); ?></small>
                                        </div>
                                    </div> 
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="emergency_contact">Emergency Contact Number</label>
                                            <input type="text" class="form-control" name="emergency_contact" id="emergency_contact" placeholder="Enter Emergency Contact Number" required>
                                            <small><?php echo form_error('emergency_contact'); ?></small>
                                        </div>
                                    </div> 
                                    <div class="col-3">
                                        <div class="form-group">
                                            <label for="emergency_contact_person">Emergency Contact Person Name ?</label>
                                            <input type="text" class="form-control" name="emergency_contact_person" id="emergency_contact_person" placeholder="Enter Emergency Contact Person Name" required>
                                            <small><?php echo form_error('emergency_contact_person'); ?></small>
                                        </div>
                                    </div>             
                                </div>                        
                            
                                <button type="submit" value="submit" class="btn btn-primary">Submit</button>
                                <button type="reset" value="reset" class="btn btn-primary">Reset</button>
public function store()
{
        $photograph = $this->input->POST('photograph');
        $name = $this->input->POST('name');
        $date_of_birth = $this->input->POST('date_of_birth');
        $date_of_joining = $this->input->POST('date_of_joining');
        $designation = $this->input->POST('designation');
        $qualification = $this->input->POST('qualification');
        $Blood_Group = $this->input->POST('Blood_Group');
        $exp_before_joining = $this->input->POST('exp_before_joining');  
        $exp_after_joining = $this->input->POST('exp_after_joining');
        $total_exp = $this->input->POST('total_exp');
        $permanent_address = $this->input->POST('permanent_address');
        $correspondance_address = $this->input->POST('correspondance_address');
        $resume = $this->input->POST('resume');
        $education_certificate = $this->input->POST('education_certificate');
        $experience_certificate = $this->input->POST('experience_certificate');
        $id_proof = $this->input->POST('id_proof');
        $address_proof = $this->input->POST('address_proof');
        $contact = $this->input->POST('contact');
        $emergency_contact = $this->input->POST('emergency_contact');  
        $emergency_contact_person = $this->input->POST('emergency_contact_person');  

        
        $configUpload['upload_path']    = 'images/';  #the folder placed in the root of project
        $configUpload['allowed_types']  = 'gif|jpg|png|bmp|jpeg';       #allowed types description
        $configUpload['max_size']       = '0';                          #max size
        $configUpload['max_width']      = '0';                          #max width
        $configUpload['max_height']     = '0';                          #max height
        $configUpload['encrypt_name']   = TRUE;                         #encrypt name of the uploaded file
        $this->load->library('upload', $configUpload);                  #init the upload class

        if (!$this->upload->do_upload()) 
        {
            $uploadedDetails    = $this->upload->display_errors();
        } 
        else 
        {
            $uploadedDetails    = $this->upload->data();
        }

        $emp_filename = $this->upload->data('file_name');
        //print_r($uploadedDetails);
        // // die;
        echo "<br><br>";

        $data = array(
            'photograph' => $emp_filename,              
            'name' => $name,
            'date_of_birth' => $date_of_birth,
            'date_of_joining' => $date_of_joining,
            'designation' => $designation,
            'qualification' => $qualification,
            'Blood_Group' => $Blood_Group,
            'exp_before_joining' => $exp_before_joining,
            'exp_after_joining' => $exp_after_joining,
            'total_exp' => $total_exp,
            'permanent_address' => $permanent_address,
            'correspondance_address' => $correspondance_address,
            'resume' => $resume,
            'education_certificate' => $education_certificate,
            'experience_certificate' => $experience_certificate,
            'id_proof' => $id_proof,
            'address_proof' => $address_proof,
            'contact' => $contact,
            'emergency_contact' => $emergency_contact,
            'emergency_contact_person' => $emergency_contact_person
        );      
    
        $this->load->model('EmployeeModel','emp');
        $this->emp->insertEmployee($data);
        redirect(base_url('add'));                
            
public function insertEmployee($data)
{
    return $this->db->insert('add_employee', $data);
}