A page about file upload. an error occurred. could you kindly advise? & lt ;! DOCTYPE & nbsp; html & nbsp; PUBLIC & nbsp;-W3CDTD & nbsp; XHTML & nbsp; 1.0 & nbsp; TransitionalEN & nbsp; www. w3.orgTRxhtml1DTDxhtml1-transitional. A file upload page. an error occurred. thank you for your guidance.
Upload.
Upload your file
This is used to call the following php on the front-end page.
if (!$_POST["upfile"]&&$_FILES["upfile"]["name"]=="")
{
echo "no file";
echo "clicktherereturn!";
}
else
{
$filepath="upload/";
$name=$filepath.$_FILES["upload"]["name"];
while (file_exists($name))
{
$temp=explode(".", $name);
$name=$temp[0]."0".".".$temp[1];
}
if(move_uploaded_file($_FILES["upfile"]["tmp_name"], $name))
{
if ($_POST["owner"])
{
$owner=$_POST["owner"];
}
else
{
$owner="NULL";
}
if ($_POST["describe"])
{
$describe=$_POST["describe"];
}
else
{
$describe="NONE";
}
$time=date("y-m-d H:m:s");
$content=$_FILES["upload"]["name"]."||".$owner."||".$describe."||".$time."\n";
file_put_contents("record.dat", $content.FILE_APPEND);
echo "name:".$_FILES["upfile"]["name"];
echo "
";
echo "is upload successfull.
";
echo "clicktherereturn!";
}
else
{
echo "upload error!
";
echo "fail!
";
echo "clicktherecheck!";
}
}
?>
The problem is that after the upload, the system prompts that the file is successfully uploaded, but the file name in the upload folder is a multiple of 0 and there is no file format. what is the problem?
The following errors are prompted ..
Notice: Undefined index: upfile in D: \ phpnow \ htdocs \ B \ up_back.php on line 2
Notice: Undefined index: upload in D: \ phpnow \ htdocs \ B \ up_back.php on line 10
Notice: Undefined offset: 1 in D: \ phpnow \ htdocs \ B \ up_back.php on line 14