title: Parse csv file that came from base64 on PHP
body: <p>I am uploading a base64 encoded CSV file through an Ajax request to my server (an ajax request is a requirement). And I am trying to parse it so I have a multidimensional array.</p>
  
  <p>The CSV file looks like this:</p>
  
  <pre><code>1, 1, 1, 1, 'Yuliana Arredondo', 'Mi razón social', 'snt@snt.snt', 'aoeaoeaoe1', 'avatar_56627eb7ea174.png', 'CUIH900419RC4', '2015-12-09', '2015-12-23', '2015-12-01', 'SYSTEM-CSV'
  1, 1, 1, 1, 'Eduardo de la Cruz', 'Mi razón social', 'snt@snt.snt', 'aoeaoeaoe1', 'avatar_56627eb7ea174.png', 'CUIH900419RC6', '2015-12-09', '2015-12-23', '2015-12-01', 'SYSTEM-CSV'
  </code></pre>
  
  <p>(Each record is separated by an enter as far as I can tell)</p>
  
  <p>And, on PHP I am trying:</p>
  
  <pre><code>if($request-&gt;input('file')){
      $b64 = $request-&gt;input('file');
      $pos  = strpos($b64, ';');
      if($pos !== false){
          $b64 = base64_decode(preg_replace('#^data:text/\w+;base64,#i', '', $b64));
      }
  }
  $array = str_getcsv($b64);
  </code></pre>
  
  <p>But on that $array, instead of getting an array with 2 records (each one with 14 fields), I am getting a plain array with 28 records.</p>
  
  <p>Am I doing something wrong? Or is it supposed to work like this? If so, is there any workaround? </p>
  
  <p>On a side note, 14 fields is consistent, so it is valid to "hardcode" that as a constant.</p>
  
  <p>Thanks in advance.</p>