![]() |
#2
lmhllr2008-02-29 11:09
|
如下代码!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. xmlns="http://www. http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>文件上传</title>
</head>
<body>
<table width="80%" border="1">
<form method="post" enctype="multipart/form-data" name="myform">
<tr>
<td><label>文件上传
<input name="myfile" type="file" id="myfile" />
</label></td>
</tr>
<tr>
<td><label>
<input type="submit" name="submit" value="上传" />
</label></td>
</tr>
</form>
<?php
//echo("你没有上传任何文件");
if(isset($submit)){
if($myfile != "none") {
$upload_dir = "d:\1";
$up=copy($myfile,$upload_dir);
if($up==1) {
print("文件上传成功!");
}
else{
print("文件上传失败!");
}
unlink($myfile);
}
else {
echo("你没有上传任何文件");
}
}
?>
</table>
</body>
</html>
<title>文件上传</title>
</head>
<body>
<table width="80%" border="1">
<form method="post" enctype="multipart/form-data" name="myform">
<tr>
<td><label>文件上传
<input name="myfile" type="file" id="myfile" />
</label></td>
</tr>
<tr>
<td><label>
<input type="submit" name="submit" value="上传" />
</label></td>
</tr>
</form>
<?php
//echo("你没有上传任何文件");
if(isset($submit)){
if($myfile != "none") {
$upload_dir = "d:\1";
$up=copy($myfile,$upload_dir);
if($up==1) {
print("文件上传成功!");
}
else{
print("文件上传失败!");
}
unlink($myfile);
}
else {
echo("你没有上传任何文件");
}
}
?>
</table>
</body>
</html>