Notice: Undefined index: userfile in C:\wamp\www\CourseWork\upload2.php on line 5
Notice: Undefined index: userfile in C:\wamp\www\CourseWork\upload2.php on line 6
Notice: Undefined index: userfile in C:\wamp\www\CourseWork\upload2.php on line 7
Notice: Undefined index: userfile in C:\wamp\www\CourseWork\upload2.php on line 8
Error uploading file.
The Code is
<?php
$uploadDir = 'C:/webroot/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);
if (!$result) {
echo "Error uploading file";
exit;
}
include 'config.php';
include 'opendb.php';
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
$filePath = addslashes($filePath);
}
$query = "INSERT INTO upload2 (name, size, type, path ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$filePath')";
mysql_query($query) or die('Error, query failed : ' . mysql_error());
}
?>
<?php
include 'closedb.php';
echo "<br>Files uploaded<br>";
?>
Can anyone please tell me what the unidentified index is all about on
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
Thank you.
** edit **

New Topic/Question
Reply




MultiQuote







|