CodeIgniter Forums
upload excel - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: upload excel (/showthread.php?tid=1884)



upload excel - El Forum - 07-03-2007

[eluser]Unknown[/eluser]
any ane can help me,
i need sample class to upload excel into mysql


upload excel - El Forum - 07-03-2007

[eluser]Rick Jolly[/eluser]
Excel could be saved as a CSV. If that works for you then you could use:
Code:
$fp = fopen($complete_path_to_the_uploaded_csv_file, "r")
while (($line = fgetcsv($fp, 1000, ",")) !== false)
{
   // $line is an array of cells for the current line in the file
  
   // do something
}

There are other examples here:
http://ca3.php.net/fgetcsv


upload excel - El Forum - 07-03-2007

[eluser]Christopher Blankenship[/eluser]
Are you sure you need to upload the excel file into the database (thats at least the way I read this post) or upload the file on the server and pass the database the name of the file and location for retrieval. The latter will be better all around.