title: Sent csv from ajax to php
body: <p>I have this code:</p>
  
  <p>Html:</p>
  
  <pre><code>&lt;input type="file" name="filename" id="filename"&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>$("#filename").change(function(e) {
  var url = $("input#filename").val();
  
   $.ajax({            
          type: "POST",
          url: "/importArticleCsv",
          dataType: "json",
          data: "url="+ url,
          success: function(response)
          {
              alert("succes");
  
          }
      });
      return false;
  
  });
  </code></pre>
  
  <p>php:</p>
  
  <pre><code>public function importArticleCsv(){      
      $url = $this-&gt;input-&gt;post('url');
  
          $csv_file = CSV_PATH . $url; // Name of your CSV file
  
  $csvfile = fopen($csv_file, 'r');
  
  $theData = fgets($csvfile);
  
  $i = 0;
  
  while (!feof($csvfile)) {
      $csv_data[] = fgets($csvfile, 1024);
      $csv_array = explode(",", $csv_data[$i]);
  
      $insert_csv = array();
      $insert_csv['ID'] = $csv_array[0];
      $insert_csv['name'] = $csv_array[1];
      $insert_csv['email'] = $csv_array[2];
  
  $i++;
  
  }
  
  fclose($csvfile);
  
  }
  </code></pre>
  
  <p>How can i upload the csv file, en send it to php so php can add everything in a array? I have all this code, and it goes to the right function but than it does nothing? how is this possible?</p>