1,html表单部分
2,文件上传程序 uploader.php
<?php
/**
* 接收文件上传信息
* by www.jb200.com
*/
if( $_FILES['file']['name'] != "" )
{
copy ( $_FILES['file']['tmp_name'],
"C:/Apache/htdocs/" . $_FILES['file']['name'] )
or die( "Could not copy file" );
}
else
{
die( "No file specified" );
}
?>
<html>
<head>
<title>上传成功</title>
</head>
<body>
<h3>文件上传成功...</h3>
<ul>
<li>文件名称: <?php echo $_FILES['file']['name']; ?></li>
<li>文件大小: <?php echo $_FILES['file']['size']; ?> bytes</li>
<li>文件类型: <?php echo $_FILES['file']['type']; ?></li>
</ul>
<a href="<?php echo $_FILES['file']['name']; ?>">点这里查看文件</a>
</body>
</html>
附:文件上传的错误代码