Hey whatsup. im a php noob and trying to create a upload script that also creats a file path in mysql so i can easily call on it later.
The upload script works just fine but i cant seem to make the query work. it basicly creats a new column with nothing in it. I must be doing something wrong with a variable but im not sure. can anyone help me?
[php]<?php
$con = mysql_connect(“localhost”,“hai”,“test”);
if (!$con)
{
die('Could not connect: ’ . mysql_error());
}
mysql_select_db(“hai”, $con);
?>
"; } else { echo "Upload: " . $_FILES["file"]["name"] . "
"; echo "Type: " . $_FILES["file"]["type"] . "
"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
"; if (file_exists("files/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "files/" . $_FILES["file"]["name"]); echo "Stored in: " . "files/" . $_FILES["file"]["name"]; } } mysql_select_db("hai", $con); $fileName = $_FILES[’SpecialFile’][’name’]; mysql_query("INSERT INTO files (locatie, Naam) VALUES ('$fileName', '$fileName')"); ?> Filename:
[/php]
