Got the following error message when I try to upload a file to an IIS webserver.
Notice: Undefined index: file in E:\website\wlan\central\internet_control\downloads\test\upload_front.php on line 21
This happens with the following code
<?
$path = strtolower("../../../internet_test/images/recievers");
if (isset($_POST['action']) && $_POST['action'] == 'upload') {
while (list ($key, $value) = each ($_FILES['uploadfile']['tmp_name'])) {
$filename = $_FILES['uploadfile']["name"][$key];
$path = strtolower("../../../internet_test/images/recievers/$filename");
$extension = substr($filename, -3);
$extension = strtolower($extension);
if ($filename != "") {
$does_file_exist = file_exists($path);
if ($does_file_exist == false) {
if ($extension == 'gif') {
$ok = (move_uploaded_file($_FILES['uploadfile']['tmp_name'][$key], $path.$_FILES['file']['name'][$key]));
if ($ok == true) {
//echo "<script type=\"text/javascript\">window.location.href = '../index.asp';</script>";
}
}
else {
echo "Invalid extension";
}
}
}
}
}
else {
echo"<form method=\"post\" action=\"\" enctype=\"multipart/form-data\">";
for( $i=1; $i<=1; $i++) {
echo "<input type=\"file\" name=\"uploadfile[]\"><br>";
}
echo"<br><INPUT TYPE=\"submit\" value=\"Upload\"><input type=\"hidden\" name=\"action\" value=\"upload\"></form>";
}
?>