Below is my code:
<?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";
}
}
?>
<form action= "upload.php" method="POST" enctype="multipart/form-data">
<input type="file" name="file" ><br><br>
<input type="Submit" value="Submit" >
</form>
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.
Notice: Undefined index: temp in C:\xampp\htdocs\testfolder\upload.php on line 3.