PHP Upload Box, I have this code but it DOESNT return the name for my DB?

  • Thread starter Thread starter Jonathon M
  • Start date Start date
J

Jonathon M

Guest
Ok I want to post the name of the file I uploaded to MYsql Database uploads in the 'name' field

<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
<?php
$dnname = $_POST[name];

$con = mysql_connect("localhost","root","majick");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("warezzf", $con);

$result=mysql_query("INSERT INTO uploads (name) VALUES ('$dnname')");

mysql_close($con);
?>

This code echos the correct information but puts it in my DBV as blank, Thanks to anyone who answers these as they are annoying :>
 
Back
Top