title: File upload by ajax $.post not working
body: <p>I am really new to ajax do forgive me if the question is stupid. I have a multi step form and it  has the 4 parts , and I am using <code>$.post()</code> ajax request to send this. while all my other details are going fine I am not able to upload my file. this is what I am trying to do</p>
  
  <p>Here I am trying to catch the form values.</p>
  
  <pre><code>var data_img = new FormData();
  var hello = $.each(jQuery('#pan_file')[0].files, function (i, file) {
                  data_img.append('file-' + i, file);
               });
  </code></pre>
  
  <p>Then I am passing these values to the object variable.</p>
  
  <pre><code>obj_params.pan_file = hello;
  </code></pre>
  
  <p>And then sending it to store with <code>ajax.post()</code></p>
  
  <pre><code>$.post('&lt;?php echo base_url(); ?&gt;get-ekyc-form', obj_params, function (msg) {
      if (msg == "1") {
          swal("Success!", "EKYC Form has been Submitted Successfully", "success");
          window.location = '&lt;?php echo base_url(); ?&gt;list-active-requirement';
      }
  }, "json", "processData:false", "contentType:false");
  return true;
  </code></pre>
  
  <p>And this is where I do file transfer.</p>
  
  <pre><code>if ($_FILES['file-0']['name'] != "") {
      $image_data = array();
      //config initialise for uploading image 
      $config['upload_path'] = './media/front/img/quote-docs/';
      $config['allowed_types'] = 'xlsx|pdf|doc|docx';
      $config['max_size'] = '5000';
      $config['max_width'] = '12024';
      $config['max_height'] = '7268';
      $config['file_name'] = time();
      //loading upload library
      $this-&gt;upload-&gt;initialize($config);
      $this-&gt;load-&gt;library('upload', $config);
      if (!$this-&gt;upload-&gt;do_upload('file-0')) {
          $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
      } else {
          $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
          $image_data = $this-&gt;upload-&gt;data();
          $file_name = $image_data['file-0'];
      }
      $file_name = $image_data['file_name'];
  } else {
      $file_name = '';
  }
  </code></pre>
  
  <p>Also I am working on someone elses code so I do understand I must have made loads of mistakes. I'll be grateful if someone could help me around this.</p>