I recently had a problem similar to this, but I modified the script to do something else and now i am running into another issue when I run it, I get
Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\wamp\www\Test\Upload\index.php on line 52. I have verified that the file is uploaded correctly and deposited into the correct folder.
Here is the offending part of the script.
Code: Select all
case 'csv':
$destfile='C:\wamp\www\Test\Upload\Files\csv\\' . basename($_FILES['upload']['name']);
$ret = move_uploaded_file($_FILES['upload']['tmp_name'], $destfile);
switch ($ret)
{
case false:
echo htmlspecialchars('Unable to move file', ENT_QUOTES, 'utf-8');
break;
default:
echo htmlspecialchars('File moved successfully', ENT_QUOTES, 'utf-8');
break;
}
$sql="LOAD DATA LOCAL INFILE '" . $destfile . "'
INTO TABLE page
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(id, caption)";
mysqli_query($sql);
break;
