Not able to upload a file in PHP
<p>Below is my code:</p>

<pre><code>&lt;?php
$name = $_FILES["file"]["name"];
$temp = $_FILES["file"]["temp"];
if(isset($name))
{
if(!empty($name))
{
$location= "upload/";
if(move_uploaded_file($temp, $location.$name))
{
echo "Uploaded!!!";
}
else
{
echo "Error:";
}
}
else
{
echo "Please choose a file to upload";
}
}
?&gt;
&lt;form action= "upload.php" method="POST" enctype="multipart/form-data"&gt;
&lt;input type="file" name="file" &gt;&lt;br&gt;&lt;br&gt;
&lt;input type="Submit" value="Submit" &gt;
&lt;/form&gt; 
</code></pre>

<p>whenever i am running this code, i am getting below error, please assist. I am new to PHP and need to learn it ASAP. Thanks in advance.</p>

<blockquote>
  <p>Notice: Undefined index: temp in C:\xampp\htdocs\testfolder\upload.php on line 3.</p>
</blockquote>
