OK, I want to write a script that will allow someone to upload a txt file to a MySQL database.
The guy will login, got to the upload page where there is a form with a file input field. Simple enough, right.
The MySQL query var should look like this:
$sql = 'LOAD DATA INFILE \'c:\\php\\uploadtemp\\php1.tmp\' REPLACE INTO TABLE table_name
';
$sql .= 'FIELDS TERMINATED BY \',\'';
$sql .= 'OPTIONALLY ENCLOSED BY \'"\'';
$sql .= 'ESCAPED BY \'\\\'';
$sql .= 'LINES TERMINATED BY \'\r\n\'';
My problem lies in the file that will be uploaded. It will go to the uploadtemp directory, but what happens to it after that is a mystery to me.
I had a look at some phpMyAdmin code and found the two files that does the process in phpMyAdmin (Idi_table.php & Idi_check.php), but me being a bit of a noob at php, the files did not make a whole lot of sense.
Can someone help me with this, please?