title: php file not upload in ajax serialize
body: <p>Here is my HTML</p>
  
  <pre><code>&lt;form class="form form-vertical captcha_from" style="width: 50%;" method="post" action="&lt;?php echo base_url('home/post_job_save'); ?&gt;" enctype = "multipart/form-data"&gt;
          &lt;div class="container"&gt;
  
              &lt;div class="row form-group"&gt;
                  &lt;div class="col-xs-12"&gt;
                      &lt;ul class="nav nav-pills nav-justified thumbnail setup-panel"&gt;
                          &lt;li class=""&gt;&lt;a href="#step-1"&gt;
                              &lt;h4 class="list-group-item-heading"&gt;Add Profile&lt;/h4&gt;
                              &lt;p class="list-group-item-text"&gt;First Step&lt;/p&gt;
                          &lt;/a&gt;&lt;/li&gt;
                          &lt;li class=""&gt;&lt;a href="#step-2"&gt;
                              &lt;h4 class="list-group-item-heading"&gt;Add Resume&lt;/h4&gt;
                              &lt;p class="list-group-item-text"&gt;Second Step&lt;/p&gt;
                          &lt;/a&gt;&lt;/li&gt;
                          &lt;li class=""&gt;&lt;a href="#step-3"&gt;
                              &lt;h4 class="list-group-item-heading"&gt;Add Cover Letter&lt;/h4&gt;
                              &lt;p class="list-group-item-text"&gt;Third Step&lt;/p&gt;
                          &lt;/a&gt;&lt;/li&gt;
  
                          &lt;li class="active"&gt;&lt;a href="#step-4"&gt;
                              &lt;h4 class="list-group-item-heading"&gt;Add Photo&lt;/h4&gt;
                              &lt;p class="list-group-item-text"&gt;Fourth Step&lt;/p&gt;
                          &lt;/a&gt;&lt;/li&gt;
  
                      &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="row setup-content" id="step-1" &gt;
                  &lt;div class="col-xs-12"&gt;
                      &lt;div class="col-md-12 well"&gt;
                          &lt;h1&gt;Add Profile&lt;/h1&gt;
  
                              &lt;div class="container"&gt;
                                  &lt;div class="row clearfix"&gt;
                                      &lt;div class="col-md-12 column"&gt;
                                          &lt;div class="control-group"&gt;
                    &lt;label&gt;First Name*&lt;/label&gt;
                    &lt;div class="controls"&gt;
                      &lt;input type="text" class="form-control" placeholder="First Name" name="first_name" required=""&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div class="control-group"&gt;
                    &lt;label&gt;Last Name*&lt;/label&gt;
                    &lt;div class="controls"&gt;
                      &lt;input type="text" class="form-control" placeholder="last Name" name="last_name" required=""&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div class="control-group"&gt;
                    &lt;label&gt;Email*&lt;/label&gt;
                    &lt;div class="controls"&gt;
                      &lt;input type="email" class="form-control" placeholder="Email" name="email" required=""&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
      &lt;div class="row setup-content" id="step-2"&gt;
          &lt;div class="col-xs-12"&gt;
              &lt;div class="col-md-12 well"&gt;
                  &lt;h1 class="text-center"&gt;Add Resume&lt;/h1&gt;
                  &lt;div class="container"&gt;
                        &lt;div class="row"&gt;
                          &lt;div class="col-lg-12"&gt;
                              &lt;div class="form-group"&gt;
                                  &lt;label for="file"&gt;Select a file to upload&lt;/label&gt;
  
                                  &lt;input type="file" name="resume"&gt;
                                  &lt;p class="help-block"&gt;Only jpg,jpeg,png and gif file with maximum size of 1 MB is allowed.&lt;/p&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                        &lt;/div&gt;
                  &lt;/div&gt;&lt;!-- /container --&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="row setup-content" id="step-3"&gt;
          &lt;div class="col-xs-12"&gt;
              &lt;div class="col-md-12 well"&gt;
                  &lt;h1 class="text-center"&gt;Add Cover Letter&lt;/h1&gt;
                        &lt;div class="form-group"&gt;
                          &lt;label for="file"&gt;Select a file to upload&lt;/label&gt;
                          &lt;input type="file" name="cover_letter"&gt;
                          &lt;p class="help-block"&gt;Only jpg,jpeg,png and gif file with maximum size of 1 MB is allowed.&lt;/p&gt;
                        &lt;/div&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="row setup-content" id="step-4"&gt;
          &lt;div class="col-xs-12"&gt;
              &lt;div class="col-md-12 well"&gt;
                  &lt;h1 class="text-center"&gt;Add Photo&lt;/h1&gt;
                        &lt;div class="form-group"&gt;
                          &lt;label for="file"&gt;Select a file to upload&lt;/label&gt;
                          &lt;input type="file" name="photo"&gt;
                          &lt;p class="help-block"&gt;Only jpg,jpeg,png and gif file with maximum size of 1 MB is allowed.&lt;/p&gt;
                        &lt;/div&gt;
                        &lt;input type="submit" id="apply_job_save_submit" class="btn btn-primary btn-md" value="Submit"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
  
  &lt;/div&gt;&lt;/form&gt;
  </code></pre>
  
  <p>Js Code</p>
  
  <pre><code>$('#apply_job_save_submit').on('click', function(e) {
      $.ajax({
          type: 'post',
          url: base_url+'jobs/home/apply_job_save',
          data: $('#apply_job_save').serialize(),
          success: function () {
            document.getElementById('createarea').innerHTML = "SUCCESS";
          }
        });
  });
  </code></pre>
  
  <p>php code: </p>
  
  <pre><code>if(isset($_FILES) &amp;&amp; $_FILES["resume"]["name"]!=''){
                  $org_filename=$_FILES["resume"]["name"];
                  $arr=explode('.', $org_filename);
                  $filename='resume'.time().'.'.$arr[count($arr)-1];
                  $target_dir = UPLOAD_PATH;
                  $target_file = $target_dir . basename($filename);
                  move_uploaded_file($_FILES["resume"]["tmp_name"], $target_file);
  
                  $_POST['resume']=$filename;
              }
  
              if(isset($_FILES) &amp;&amp; $_FILES["cover_letter"]["name"]!=''){
                  $org_filename=$_FILES["cover_letter"]["name"];
                  $arr=explode('.', $org_filename);
                  $filename='cover_letter'.time().'.'.$arr[count($arr)-1];
                  $target_dir = UPLOAD_PATH;
                  $target_file = $target_dir . basename($filename);
                  move_uploaded_file($_FILES["cover_letter"]["tmp_name"], $target_file);
  
                  $_POST['cover_letter']=$filename;
              }
  
              if(isset($_FILES) &amp;&amp; $_FILES["photo"]["name"]!=''){
                  $org_filename=$_FILES["photo"]["name"];
                  $arr=explode('.', $org_filename);
                  $filename='photo'.time().'.'.$arr[count($arr)-1];
                  $target_dir = UPLOAD_PATH;
                  $target_file = $target_dir . basename($filename);
                  move_uploaded_file($_FILES["photo"]["tmp_name"], $target_file);
  
                  $_POST['photo']=$filename;
              }
  $this-&gt;general_model-&gt;insert('apply_job',$_POST);
  </code></pre>
  
  <p>Using this code I try to send some data into my database as well as upload files in my server using post method. All data posted fine but files are not uploaded.
  Showing error while uploading files
  Undefined index: resume
  Undefined index: cover_letter
  Undefined index: photo
  how to resolve this</p>