Import data from a csv file

 
<?php

ini_set('auto_detect_line_endings', true);

$filename = 'sample.csv';

$fp = fopen($filename, "r");
if ($fp) {
    while (($data = fgetcsv($fp, 3000, ",")) !== FALSE) {
        print_r($data);
    }

    fclose($fp);
}

 

Related Snippets

•  File Upload Form
•  Export/Download data as a csv file
•  Export data to a csv file