I am trying to import a file into mySql database. I got it to work locally but I can't get it to work from the internet.
Can anyone tell me what I am doing wrong? Here is the code I am using to grab the file....
<start code>
<?
if (!isset($submit)){
print "<center>
<table width=\"200\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td>";
echo ("<form action=\"$PHP_SELF\">
<input type=\"file\" name=\"filename\">
<input type=\"submit\" name=\"submit\"></form></td></tr></table></center>");
}else{
$path = $filename;
$row = 1;
$fp = fopen ("$filename","r");
print "<table width=\"457\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">
<form name=\"imports\" action=\"insert.php\" method=\"POST\">
<input type=\"hidden\" name=\"filename\" value=\"$filename\">
<tr>
<td colspan=\"3\" align=\"center\"><font color=\"#666666\"><strong>CSV Importer</strong></font></td>
</tr>
<tr>
<td><strong>First Name</strong></td>
<td><strong>Lastname</strong></td>
<td><strong>Verification#</strong></td>
</tr>
<tr>";
while ($data = fgetcsv ($fp, 1000, ",")) {
$num = count ($data);
$first = $data[0];
$last= $data[1];
$valid = $data[7];
print "<tr>";
print "<td>$first</td>";
print "<td>$last</td>";
print "<td>$valid</td>";
print "</tr>";
// Show all Items In a table
$row++;
for ($c=0; $c < $num; $c++) {
}
}
fclose ($fp);
print "</tr>
<tr><td><tr>There are $num fields in this import.<br><br>\n</td></tr>
<tr><td colspan=\"3\"><input type=\"submit\" value=\"Submit\"></td></tr>
</form>
</table>
</td>
</tr>
</table>
";
}
?>
</end code>