Here's some code that I use, but you'll have to figure out the input form slightly.
if (isset($submit) && ($file != '')) {
// need the following variables to run
$table = 'A1';//db table A1_test
$char;//comma, semi_colon, tab etc
$line_terminator; //\n, \r etc
//$connection = mysql_connect("$host", "$login", "$password") OR DIE ("unable to connect");
mysql_select_db ($db);
$line_terminator = stripslashes($line_terminator);
$char = stripslashes($char);
$query = "LOAD DATA LOCAL INFILE '$file' INTO TABLE $table FIELDS TERMINATED BY '$char' ENCLOSED BY '\"' LINES TERMINATED BY '$line_terminator'";
//print $query;
$result = mysql_query($query) or die("Error in query");
//echo mysql_errno().": ".mysql_error()."<br />";
mysql_close($connection);
//print a new page
echo"
Thank you for your upload.";
You need to have a form with the file name, the line terminator (\n - unix, \n\r -pc etc.) and the seperator (colon, comma, semi-colon).
Your php.ini file needs to be set allow uploads. You need a tmp directory that the web server is allowed to upload to. If you look in the mysql manual you'll find that there a couple of other options that are not included in the SQL query I have above (for simplicity).
HTH