下面是我的代码:
<?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>
每当我运行此代码时,我都会遇到错误,请协助。我是 PHP 新手,需要尽快学习。提前致谢。
注意:未定义的索引:第 3 行 C:\xampp\htdocs\testfolder\upload.php 中的 temp。