【 tulaoshi.com - PHP 】
1.upfile.php文件
<html
<body
<title文件上传</title
<form enctype="multipart/form-data" action=upload.php method=post
<input type=file name=upfile size=10<br<br
<input type=submit value='上载文件'
</form
</body
</html
2.upload.php
<?
//取得当前日期信息,并连接成为一个字符串
$datetime = getdate();
$time = implode("",$datetime);
//构造文件名
//$filename="uploadfiles/".$time." ".$upfile_name;
$filename="uploadfiles/".$upfile_name;
//将文件实际的存放在服务器上
$copymes = copy($upfile,$filename);
if ($copymes) {
print("文件上传成功!<brn");
print("文件名:$upfile_name<brn");
print("上传的文件大小:$upfile_size<brn");
}
else print("文件上传失败!<brn");
if (($upfile_type=="image/gif")||($upfile_type=="image/pjpeg"))
{
//如果是图形文件格式则显之
echo "<p<img src="http://img.jcwcn.com/attachment/portal"