时间:2021-07-01 10:21:17 帮助过:14人阅读
upload.
upload your file
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!";
}
}
?>