动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
  
   PHP → 阅读文章

 多文件上载系统完整版

作者来源: 
阅读 1511 人次 , 2006-3-29 4:16:00 


<?php
//多文件上载系统完整版
//功能强大,可任意控制上载文件数,是否覆盖

include("../include/common.inc");
$title = "多个文件的上载程序";
include("../include/header.inc");

//定义允许上载文件的数目

define("upload_no", 10);

echo("<p align='center'><font size='4' color='#000080'>欢迎您!<br>一次可以最多上载".upload_no."个文件<br><hr>n");
if($request_method!="post"){
echo("<form enctype="multipart/form-data" method=post>n");
echo("<input type="hidden" name="max_file_size" value="3000000">n");
 
for($i=1;$i<=upload_no;$i++){
echo("<input type=file name=infile$i>  ");

if($i%2==0)
echo("<br>n");
}
 
echo("<br><br><input type="checkbox" name="overload" value="on"></font> <font color='#ff0000'>是否覆盖已经存在的文件?</font>");
echo("<br><br><input type=submit value=上载></form>n");
}
else{
//处理上载
$noinput = true;
for($i=1;$noinput&&($i<=upload_no);$i++){
 if(${"infile".$i}!="none") $noinput = false;
}
if($noinput){
echo("<font size='4' color='#000080'>没有选定的文件,返回重试</font>");
exit();
}
echo("<p align='center'><font size='4' color='#000080'>您选中的文件已经成功地上载到服务器的临时目录!</font><br>");  
echo("<table border='1' width='84%' height='52' bordercolorlight='#008080' bordercolordark='#008080'>
<tr>
<td width='14%' bgcolor='#008000' height='21'><font color='#ffffff'>文件号</font></td>
<td width='52%' bgcolor='#008000' height='21'><font color='#ffffff'>文件名称</font></td>
<td width='34%' bgcolor='#008000' height='21'><font color='#ffffff'>文件大小</font></td>
</tr>");

for($i=1;$i<=upload_no;$i++){
$just=${"infile".$i."_size"};
$fp_size[i] = $just;
 
if($overload!=on){
if(file_exists(addslashes(dirname($path_translated))."\upload\".${"infile".$i."_name"}))
echo "<font size='4' color='#ff0000'>您上载的文件<font color='#000000'>".${"infile".$i."_name"}."</font>已经存在,该文件拷贝失败!</font><br>";
else{
if(${"infile".$i}!="none"&©(${"infile".$i},addslashes(dirname($path_translated))."/upload/".${"infile".$i."_name"})&&unlink(${"infile".$i})){
$str = ${"infile".$i."_name"};
echo("<tr>
<td width='14%' height='19'>$i</td>
<td width='52%' height='19'>$str</td>
<td width='34%' height='19'>$fp_size[i]</td>
</tr>");
}
}
}
else{
if(${"infile".$i}!="none"&©(${"infile".$i},addslashes(dirname($path_translated))."upload".${"infile".$i."_name"})&&unlink(${"infile".$i})){
$str = ${"infile".$i."_name"};
echo("<tr>
<td width='14%' height='19'>$i</td>
<td width='52%' height='19'>$str</td>
<td width='34%' height='19'>$fp_size[i]</td>
</tr>");
}
}

}
echo "</table>";  
}

include("../include/footer.inc");
 
?>

--------------
        \\\|///
       \\ .-.- //
       ( .@.@ )
+-----------oooo-----(_)-----oooo----------+
|   网海茫茫,认识你是我的福份; |
| 网语缠绵,那是我们注定的缘份。 |
|  xjy    |
|  ★代码中国★      |
| http://www.codechina.net |

 
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:文件上传类
· 下一篇:PHP出错界面
· 第七节--类的静态成员 -- Classes and Objects in PHP5 [7]
· php的类和对象
· 获取信息实例
· 登陆界面限制到只允许一台机器在线
· PHP4.04 新增加了专用的字符函数 Ctype


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077