title: Getting error while uploading image and files in CodeIgniter
body: <p>I have created an employee registration form but I'm getting errors in image uploading and storing in the image folder and also getting errors in document file uploading. and errors like
  <strong>Error Number: 1048
  Column 'resume' cannot be null
  INSERT INTO <code>add_employee</code> (<code>photograph</code>, <code>name</code>, <code>date_of_birth</code>, <code>date_of_joining</code>, <code>designation</code>, <code>qualification</code>, <code>Blood_Group</code>, <code>exp_before_joining</code>, <code>exp_after_joining</code>, <code>total_exp</code>, <code>permanent_address</code>, <code>correspondance_address</code>, <code>resume</code>, <code>education_certificate</code>, <code>experience_certificate</code>, <code>id_proof</code>, <code>address_proof</code>, <code>contact</code>, <code>emergency_contact</code>, <code>emergency_contact_person</code>) VALUES ('', 'xxx', '2021-04-10', '2021-04-10', 'Production', 'MCA', 'O+ve', '4', '4', '4', 'asdfgh \r\n ', ' hjghjfghdgfd,ghfchhf\r\n ', NULL, NULL, NULL, NULL, NULL, '6754321234', '6789557890', 'xzxz')
  Filename: C:/xampp/htdocs/maheshfoundation/system/database/DB_driver.php
  Line Number: 691</strong></p>
  <h2>my view file</h2>
  <pre><code>&lt;?php echo form_open_multipart('employee/store');?&gt;
                                  &lt;div class=&quot;row&quot;&gt;
                                      
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;photograph&quot;&gt;Photograph&lt;/label&gt;
                                              &lt;input type=&quot;file&quot; class=&quot;form-control&quot; name=&quot;photograph&quot; id=&quot;photograph&quot; placeholder=&quot;Choose file&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('photograph'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;  
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;name&quot;&gt;Enter Name&lt;/label&gt;
                                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;name&quot; id=&quot;name&quot; placeholder=&quot;Enter Name&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('name'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt; 
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;date_of_birth&quot;&gt;Date of Birth&lt;/label&gt;
                                              &lt;input type=&quot;date&quot; class=&quot;form-control&quot; name=&quot;date_of_birth&quot; id=&quot;date_of_birth&quot; placeholder=&quot;DOB&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('date_of_birth'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt; 
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;date_of_joining&quot;&gt;Date of Joining&lt;/label&gt;
                                              &lt;input type=&quot;date&quot; class=&quot;form-control&quot; name=&quot;date_of_joining&quot; id=&quot;date_of_joining&quot; placeholder=&quot;DOJ&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('date_of_joining'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;             
                                  &lt;/div&gt;
  
                                  &lt;div class=&quot;row&quot;&gt;
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;designation&quot;&gt;Designation&lt;/label&gt;
                                              &lt;select class=&quot;form-control&quot; name=&quot;designation&quot; id=&quot;designation&quot; required&gt;
                                                  &lt;option value=&quot;select&quot;&gt;---Select---&lt;/option&gt;
                                                  &lt;option value=&quot;Marketing&quot;&gt;Marketing&lt;/option&gt;
                                                  &lt;option value=&quot;Design&quot;&gt;Design&lt;/option&gt;
                                                  &lt;option value=&quot;Super Admin&quot;&gt;Super Admin&lt;/option&gt;
                                                  &lt;option value=&quot;Purchase&quot;&gt;Purchase&lt;/option&gt;
                                                  &lt;option value=&quot;Planning&quot;&gt;Planning&lt;/option&gt;
                                                  &lt;option value=&quot;Production&quot;&gt;Production&lt;/option&gt;
                                                  &lt;option value=&quot;Quality&quot;&gt;Quality&lt;/option&gt;
                                                  &lt;option value=&quot;Stores&quot;&gt;Stores&lt;/option&gt;
                                                  &lt;option value=&quot;Management&quot;&gt;Management&lt;/option&gt;
                                                  &lt;option value=&quot;HR&quot;&gt;HR&lt;/option&gt;
                                              &lt;/select&gt;
                                              &lt;small&gt;&lt;?php echo form_error('designation'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;  
                              
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;qualification&quot;&gt;Qualification&lt;/label&gt;
                                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;qualification&quot; id=&quot;qualification&quot; placeholder=&quot;Enter qualification&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('qualification'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt; 
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;Blood Group&quot;&gt;Blood Group&lt;/label&gt;
                                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;Blood_Group&quot; id=&quot;Blood_Group&quot; placeholder=&quot;Enter Blood Group&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('Blood_Group'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt; 
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;exp_before_joining&quot;&gt;Experience Before Joining&lt;/label&gt;
                                              &lt;input type=&quot;number&quot; class=&quot;form-control&quot; name=&quot;exp_before_joining&quot; id=&quot;exp_before_joining&quot; placeholder=&quot;Enter Experience Before Joining&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('exp_before_joining'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;             
                                  &lt;/div&gt;
  
  
                                  &lt;div class=&quot;row&quot;&gt;
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                          &lt;label for=&quot;exp_after_joining&quot;&gt;Experience After Joining&lt;/label&gt;
                                              &lt;input type=&quot;number&quot; class=&quot;form-control&quot; name=&quot;exp_after_joining&quot; id=&quot;exp_after_joining&quot; placeholder=&quot;Enter Experience After Joining&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('exp_after_joining'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;  
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;total_exp&quot;&gt;Total Experience&lt;/label&gt;
                                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;total_exp&quot; id=&quot;total_exp&quot; placeholder=&quot;Enter Total Experience&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('total_exp'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt; 
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;Permanent_Address&quot;&gt;Permanent Address *&lt;/label&gt;
                                              &lt;textarea class=&quot;form-control&quot; id=&quot;permanent_address&quot; name=&quot;permanent_address&quot; rows=&quot;4&quot; cols=&quot;50&quot; required&gt; 
                                              &lt;/textarea&gt;
                                              &lt;small&gt;&lt;?php echo form_error('permanent_address'); ?&gt;&lt;/small&gt;                                       
                                              
                                          &lt;/div&gt;
                                      &lt;/div&gt; 
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;Correspondance_Address&quot;&gt;Correspondance Address&lt;/label&gt;
                                              &lt;textarea class=&quot;form-control&quot; id=&quot;correspondance_address&quot; name=&quot;correspondance_address&quot; rows=&quot;4&quot; cols=&quot;50&quot; required&gt; 
                                              &lt;/textarea&gt;
                                              &lt;small&gt;&lt;?php echo form_error('correspondance_address'); ?&gt;&lt;/small&gt; 
                                          &lt;/div&gt;
                                      &lt;/div&gt;             
                                  &lt;/div&gt;
  
                                  &lt;div class=&quot;row&quot;&gt;
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;resume&quot;&gt;Resume&lt;/label&gt;
                                              &lt;input type=&quot;file&quot; class=&quot;form-control&quot; name=&quot;resume&quot; id=&quot;resume&quot; placeholder=&quot;Choose file&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('resume'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;  
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;Education_Certificate&quot;&gt;Education Certificate&lt;/label&gt;
                                              &lt;input type=&quot;file&quot; class=&quot;form-control&quot; name=&quot;education_certificate&quot; id=&quot;education_certificate&quot; placeholder=&quot;Enter Name&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('education_certificate'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt; 
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;Experience_Certificate&quot;&gt;Experience Certificate&lt;/label&gt;
                                              &lt;input type=&quot;file&quot; class=&quot;form-control&quot; name=&quot;experience_certificate&quot; id=&quot;experience_certificate&quot; placeholder=&quot;DOB&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('experience_certificate'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt; 
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;id_proof&quot;&gt;ID Proof *&lt;/label&gt;
                                              &lt;input type=&quot;file&quot; class=&quot;form-control&quot; name=&quot;id_proof&quot; id=&quot;id_proof&quot; placeholder=&quot;DOJ&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('id_proof'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;             
                                  &lt;/div&gt;
  
                                  &lt;div class=&quot;row&quot;&gt;
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;Address_Proof&quot;&gt;Address Proof&lt;/label&gt;
                                              &lt;input type=&quot;file&quot; class=&quot;form-control&quot; name=&quot;address_proof&quot; id=&quot;address_proof&quot; placeholder=&quot;Choose file&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('address_proof'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;  
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;contact&quot;&gt;Permanent Contact Number *&lt;/label&gt;
                                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;contact&quot; id=&quot;contact&quot; placeholder=&quot;Enter Permanent Contact Number&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('contact'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt; 
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;emergency_contact&quot;&gt;Emergency Contact Number&lt;/label&gt;
                                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;emergency_contact&quot; id=&quot;emergency_contact&quot; placeholder=&quot;Enter Emergency Contact Number&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('emergency_contact'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt; 
                                      &lt;div class=&quot;col-3&quot;&gt;
                                          &lt;div class=&quot;form-group&quot;&gt;
                                              &lt;label for=&quot;emergency_contact_person&quot;&gt;Emergency Contact Person Name ?&lt;/label&gt;
                                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;emergency_contact_person&quot; id=&quot;emergency_contact_person&quot; placeholder=&quot;Enter Emergency Contact Person Name&quot; required&gt;
                                              &lt;small&gt;&lt;?php echo form_error('emergency_contact_person'); ?&gt;&lt;/small&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;             
                                  &lt;/div&gt;                        
                              
                                  &lt;button type=&quot;submit&quot; value=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Submit&lt;/button&gt;
                                  &lt;button type=&quot;reset&quot; value=&quot;reset&quot; class=&quot;btn btn-primary&quot;&gt;Reset&lt;/button&gt;
  </code></pre>
   
  <h2>my controller file</h2>
  <pre><code>public function store()
  {
          $photograph = $this-&gt;input-&gt;POST('photograph');
          $name = $this-&gt;input-&gt;POST('name');
          $date_of_birth = $this-&gt;input-&gt;POST('date_of_birth');
          $date_of_joining = $this-&gt;input-&gt;POST('date_of_joining');
          $designation = $this-&gt;input-&gt;POST('designation');
          $qualification = $this-&gt;input-&gt;POST('qualification');
          $Blood_Group = $this-&gt;input-&gt;POST('Blood_Group');
          $exp_before_joining = $this-&gt;input-&gt;POST('exp_before_joining');  
          $exp_after_joining = $this-&gt;input-&gt;POST('exp_after_joining');
          $total_exp = $this-&gt;input-&gt;POST('total_exp');
          $permanent_address = $this-&gt;input-&gt;POST('permanent_address');
          $correspondance_address = $this-&gt;input-&gt;POST('correspondance_address');
          $resume = $this-&gt;input-&gt;POST('resume');
          $education_certificate = $this-&gt;input-&gt;POST('education_certificate');
          $experience_certificate = $this-&gt;input-&gt;POST('experience_certificate');
          $id_proof = $this-&gt;input-&gt;POST('id_proof');
          $address_proof = $this-&gt;input-&gt;POST('address_proof');
          $contact = $this-&gt;input-&gt;POST('contact');
          $emergency_contact = $this-&gt;input-&gt;POST('emergency_contact');  
          $emergency_contact_person = $this-&gt;input-&gt;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-&gt;load-&gt;library('upload', $configUpload);                  #init the upload class
  
          if (!$this-&gt;upload-&gt;do_upload()) 
          {
              $uploadedDetails    = $this-&gt;upload-&gt;display_errors();
          } 
          else 
          {
              $uploadedDetails    = $this-&gt;upload-&gt;data();
          }
  
          $emp_filename = $this-&gt;upload-&gt;data('file_name');
          //print_r($uploadedDetails);
          // // die;
          echo &quot;&lt;br&gt;&lt;br&gt;&quot;;
  
          $data = array(
              'photograph' =&gt; $emp_filename,              
              'name' =&gt; $name,
              'date_of_birth' =&gt; $date_of_birth,
              'date_of_joining' =&gt; $date_of_joining,
              'designation' =&gt; $designation,
              'qualification' =&gt; $qualification,
              'Blood_Group' =&gt; $Blood_Group,
              'exp_before_joining' =&gt; $exp_before_joining,
              'exp_after_joining' =&gt; $exp_after_joining,
              'total_exp' =&gt; $total_exp,
              'permanent_address' =&gt; $permanent_address,
              'correspondance_address' =&gt; $correspondance_address,
              'resume' =&gt; $resume,
              'education_certificate' =&gt; $education_certificate,
              'experience_certificate' =&gt; $experience_certificate,
              'id_proof' =&gt; $id_proof,
              'address_proof' =&gt; $address_proof,
              'contact' =&gt; $contact,
              'emergency_contact' =&gt; $emergency_contact,
              'emergency_contact_person' =&gt; $emergency_contact_person
          );      
      
          $this-&gt;load-&gt;model('EmployeeModel','emp');
          $this-&gt;emp-&gt;insertEmployee($data);
          redirect(base_url('add'));                
              
  </code></pre>
  <p>}</p>
  <h2>my model file</h2>
  <pre><code>public function insertEmployee($data)
  {
      return $this-&gt;db-&gt;insert('add_employee', $data);
  }
  </code></pre>