<head>
<script language="javascript" type="text/javascript">
function notice() {//通知用户文件上传成功
alert("文件上传成功!");
}
</script>
</head>
<body>
<form target="fileUp" method="POST" action="file.php">
选择上传的文件<input type="file" name="fileUpLoad" />
<input type="submit" value="上传" />
</form>
<iframe width="0px" height="0px" name="fileUp"></iframe>
</body>
</html>
$path = "C:\temp\";//设置上传路径为C:\temp
if(iswritable($path)) {//目录可写
if($_FILES["fileUp"]["tmp_name"] != "none") {
copy($_FILES["fileUp"]["tmp_name"],$path."aaa.dat");
unlink($_FILES["fileUp"]["tmp_name"]);
echo "<script>parent.notice();</script>";
}
}
?>