Can anyone tell me what's wrong with this code? The file uploads just fine, and the file info (path, size, type, name) are added to the database properly. But everything else (all the $_POSTs) do not submit to the database. Any ideas?
<?
$uploadDir = 'C:/Inetpub/wwwroot/upload/';
if(isset($_POST['upload']))
{
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
$filePath = $uploadDir . $fileName;
$result = move_uploaded_file($tmpName, $filePath);
$fileUser = $_POST['fileUser'];
$filePub = $_POST['filePub'];
$fileDestination = $_POST['fileDestination'];
$fileRuns = $_POST['fileRuns'];
$fileNotes = $_POST['fileNotes'];
if (!$result) {
echo "Error uploading file";
exit;
}
include 'include/config.php';
include 'include/opendb.php';
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
$filePath = addslashes($filePath);
}
$query = "INSERT INTO upload (name, type, size, path, user, pub, destination, runs, notes) VALUES ('$fileName', '$fileType', '$fileSize', '$filePath', '$fileUser', '$filePub', '$fileDestination', '$fileRuns', '$fileNotes')";
mysql_query($query) or die('Error, query failed : ' . mysql_error());
include 'include/closedb.php';
echo "<br>File uploaded<br>";
}
?>
<form action="" method="post" enctype="multipart/form-data" name="uploadform">
<span class="left">Choose your file:</span>
<span class="right">
<input type="hidden" name="MAX_FILE_SIZE" value="500000000">
<input type="hidden" name="fileUser" id="fileUser" value="<?=$session->username?>">
<input name="userfile" type="file" class="box" id="userfile">
</span>
<br />
<span class="left">Publication:</span>
<span class="right">
<select name="filePub" id="filePub">
<option selected="selected">Choose...</option>
<option value="Special Sections">Special Sections</option>
</select>
</span>
<br />
<span class="left">Destination:</span>
<span class="right">
<select name="fileDestination" id="fileDestination">
<option selected="selected">Choose...</option>
<option value="Advertising">Advertising</option>
</select>
</span>
<br />
<span class="left">Runs:</span>
<span class="right">
<input class="input" name="fileRuns" id="fileRuns"> <img src="media/datebutton.png" alt=""
onclick="displayDatePicker('fileRuns');" class="datebutton" />
</span>
<br />
<span class="left">Notes:</span>
<span class="right"><textarea name="fileNotes" id="fileNotes" cols="40" rows="5" wrap="physical"></textarea>
<br />
<input name="upload" type="submit" class="box" id="upload" value=" Upload "></span>
</form>