search
Homephp教程php手册PHP实例:用PHP实现多文件上载系统程序

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment