0

I have just uploaded a csv file and it is stored in the harddrive of my local system and i want to display all the content of the last uploaded csv file in a table in the same ctp page through which i have uploaded the file.Please kindly help me to do this. Thanks in advance

  • http://stackoverflow.com/questions/1269562/how-to-create-an-array-from-a-csv-file-using-php-and-the-fgetcsv-function after you have it in an array. Just use it to fill your table and then unlink(file) to remove it from server – Asheliahut Jan 23 '15 at 06:33

1 Answers1

0
$rowseparator = "\n";
$columnseparator = ",";
$filename = "path/to/your/file.csv";
$rawdata = file_get_contents($filename);
foreach (explode($rowseparator, $rawdata) as $row) {
    foreach (explode($columnseparator, $row) as $column) {
        // you now know what to do
    }
}
rooobertek
  • 301
  • 1
  • 4