form file
Posted: Sun Dec 11, 2011 10:50 pm
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="name">Name:</label><br />
<input type="text" name="name" value="" /><br />
<label form="email">Email:</label><br />
<input type="text" name="email" value="" /><br />
<label form="homework">Class notes:</label><br />
<input type="file" name="homework" value="Choose the file u want to upload" /><br />
<input type="submit" name="submit" value="Submit Homework" />
</form>
///
upload_file.php
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000))
{
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"];
}
}
else
{
echo "Invalid file";
}
?
am getting this error
Notice: Undefined index: file in C:\wamp\www\my_phpinfo\upload_file.php on line
??