多文件上传的例子_PHP
程序员文章站
2022-05-02 11:03:02
...
多文件上传的例子
//upload_html.php---------------------------------------------------------------------------------------------
上传文件
//-----------------------------------------------------------------------------------------------------------------------
//upload.php-------------------------------------------------------------------------------------------------------------
//upload_path:文件要上传到的目录路径
for($i=1;$i{
$upfile="upfile".strval($i);
if(chop($$indexname)!="" and chop($$upfile)!="")
{
$upfilename=($upfile."_name");
$filename=upload_path.$$upfilename;
$copyfile = copy($$upfile,$filename);
if (!$copyfile)
die("文件上传失败!");
$ls_file.=$$upfilename."\n";
$flag=1 ;
}
}
if($flag){
$ls_msg="文件\n".$ls_file."上传成功!";
}
else{
$ls_msg="无文件上传,请重新选择!";
}
echo "\n" ;
echo "\n" ;
echo "\n" ;
echo "\n" ;
echo $ls_msg."\n";
echo "\n" ;
echo "\n" ;
?>
//-----------------------------------------------------------------------------------------------------------------------
//upload.php-------------------------------------------------------------------------------------------------------------
//upload_path:文件要上传到的目录路径
for($i=1;$i{
$upfile="upfile".strval($i);
if(chop($$indexname)!="" and chop($$upfile)!="")
{
$upfilename=($upfile."_name");
$filename=upload_path.$$upfilename;
$copyfile = copy($$upfile,$filename);
if (!$copyfile)
die("文件上传失败!");
$ls_file.=$$upfilename."\n";
$flag=1 ;
}
}
if($flag){
$ls_msg="文件\n".$ls_file."上传成功!";
}
else{
$ls_msg="无文件上传,请重新选择!";
}
echo "\n" ;
echo "\n" ;
echo "\n" ;
echo "\n" ;
echo $ls_msg."\n";
echo "\n" ;
echo "\n" ;
?>
下一篇: if条件语句