Home  >  Article  >  php教程  >  PHP实例:用PHP实现多文件上载系统程序

PHP实例:用PHP实现多文件上载系统程序

WBOY
WBOYOriginal
2016-06-21 09:01:27970browse

PHP实例:用PHP实现多文件上载系统程序

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

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

define("UPLOAD_NO", 10);

echo("

欢迎您!
一次可以最多上载".UPLOAD_NO."个文件


n");
if($REQUEST_METHOD!="POST"){
echo("
n");
echo("n");

for($i=1;$iecho(" ");

if($i%2==0)
echo("
n");
}

echo("

是否覆盖已经存在的文件?");
echo("

n");
}
else{
//处理上载
$noinput = true;
for($i=1;$noinput&&($iif(${"infile".$i}!="none") $noinput = false;
}
if($noinput){
echo("没有选定的文件,返回重试");
exit();
}
echo("

您选中的文件已经成功地上载到服务器的临时目录!
");
echo("






");

for($i=1;$i$just=${"infile".$i."_size"};
$fp_size[i] = $just;

if($overload!=ON){
if(file_exists(AddSlashes(dirname($PATH_TRANSLATED))."\upload\".${"infile".$i."_name"}))
echo "您上载的文件".${"infile".$i."_name"}."已经存在,该文件拷贝失败!
";
else{
if(${"infile".$i}!="none"&©(${"infile".$i},AddSlashes(dirname($PATH_TRANSLATED))."/upload/".${"infile".$i."_name"})&&unlink(${"infile".$i})){
$str = ${"infile".$i."_name"};
echo("





");
}
}
}
else{
if(${"infile".$i}!="none"&©(${"infile".$i},AddSlashes(dirname($PATH_TRANSLATED))."upload".${"infile".$i."_name"})&&unlink(${"infile".$i})){
$str = ${"infile".$i."_name"};
echo("



");
}
}

}
echo "

文件号 文件名称 文件大小
$i $str $fp_size[i]
$i $str $fp_size[i]
";
}

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

?>



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn