PHP上传单个文件并保存至服务器

[php]
<?php
header("content-type:text/html;charset=utf-8");
if($_FILES[‘upload’][‘error’]!=0)
{
echo "上传文件发生错误";
exit();
}
if($_FILES[‘upload’][‘size’]>2*1024*1024)
{
echo "上传文件大小超出要求";
exit();
}
$src = $_FILES[‘upload’][‘tmp_name’];
$dst = "./upload/".$_FILES[‘upload’][‘name’];
if(!move_uploaded_file($src,$dst))
{
echo "上传文件移动保存失败";
exit();
}
echo "上传文件成功";
?>
[/php]

[html]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>文件上传</title>
</head>
<body>
<form name="form1" method="post" enctype="multipart/form-data" action="upload.php">
上传图片:<input type="file" name="upload">
<input type="submit" value="提交表单">
</form>
</body>
</html>
[/html]