[eluser]Dennis Geus[/eluser]
ok,
well it's working.
Code:
$path = './uploads/';
$file = $upload_data['file_name'];
if ($upload_data['file_ext'] == ".csv") {
$fieldterm = ";";
$lineterm = "\\r\\n";
}
if ($upload_data['file_ext'] == ".txt") {
$fieldterm = "\\t";
$lineterm = "\\r\\n";
}
$this->db->simple_query("LOAD DATA LOCAL INFILE '".$path.$file."' INTO TABLE temp FIELDS TERMINATED BY '".$fieldterm."' LINES TERMINATED BY '".$lineterm."' IGNORE 1 LINES");
The only problem is that it always returns als FALSE (but it inserts the data), so I can't do any checks with it.
I think I'll have to do a query on the temp table to see if it has data before I continue with the rest.