国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

PHP實例:用PHP實現多文件上載系統程序

2024-05-04 23:02:54
字體:
來源:轉載
供稿:網友
,歡迎訪問網頁設計愛好者web開發。

php實例:用php實現多文件上載系統程序

<?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"&&copy;(${"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"&&copy;(${"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");

?>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 长汀县| 池州市| 临安市| 麻栗坡县| 宝丰县| 江陵县| 张家川| 巴塘县| 上思县| 恩施市| 东源县| 南宁市| 托克逊县| 日照市| 保定市| 肥东县| 卓尼县| 嘉善县| 凤翔县| 呼伦贝尔市| 浙江省| 扶沟县| 涟源市| 临夏市| 泸州市| 九龙坡区| 东乡| 册亨县| 镇原县| 左贡县| 辰溪县| 仙居县| 区。| 静安区| 盐山县| 千阳县| 塔河县| 遂宁市| 攀枝花市| 北辰区| 明光市|