当前位置: 首页 > 图文教程 > 网络编程 > PHP > 文件上传程序的全部源码

PHP
PHP新手总结的PHP基础知识
php实现gb2312和unicode间编码转换
用php语言实现数据库连接详细代码介绍
详细解析 PHP 向 MySQL 发送数据过程
利用PHP V5开发多任务应用程序
详细讲解PHP中缓存技术的应用
php escapeshellcmd多字节编码漏洞
《PHP设计模式介绍》导言
《PHP设计模式介绍》第一章 编程惯用法
《PHP设计模式介绍》第二章 值对象模式
《PHP设计模式介绍》第三章 工厂模式
《PHP设计模式介绍》第四章 单件模式
《PHP设计模式介绍》第五章 注册模式
《PHP设计模式介绍》第六章 伪对象模式
《PHP设计模式介绍》第七章 策略模式
《PHP设计模式介绍》第八章 迭代器模式
《PHP设计模式介绍》第九章 观测模式
《PHP设计模式介绍》第十章 规范模式
《PHP设计模式介绍》第十一章 代理模式
《PHP设计模式介绍》第十二章 装饰器模式

PHP 中的 文件上传程序的全部源码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 210 ::
收藏到网摘: n/a

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("文件上传成功!<br>n");
print("文件名:$upfile_name<br>n");
print("上传的文件大小:$upfile_size<br>n");
}
else print("文件上传失败!<br>n");
if (($upfile_type=="image/gif")||($upfile_type=="image/pjpeg"))
{
//如果是图形文件格式则显之
echo "<p><img src='";
echo $filename;
echo "'height=150 width=150 align=center border=0>";
}
?>
3.请在上面的那个文件所在目录创建一个目录 uploadfiles 就可以了
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】