明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線(xiàn)學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

多文件上載系統(tǒng)完整版

[摘要]<?php //多文件上載系統(tǒng)完整版 //功能強(qiáng)大,可任意控制上載文件數(shù),是否覆蓋 include("../include/common.inc"); title = "多個(gè)文件的上載程序"; include("../include/header....
<?php
//多文件上載系統(tǒng)完整版
//功能強(qiáng)大,可任意控制上載文件數(shù),是否覆蓋

include("../include/common.inc");
$title = "多個(gè)文件的上載程序";
include("../include/header.inc");

//定義允許上載文件的數(shù)目

define("UPLOAD_NO", 10);

echo("<p align='center'><font size='4' color='#000080'>歡迎您。糱r>一次可以最多上載".UPLOAD_NO."個(gè)文件<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'>是否覆蓋已經(jīng)存在的文件?</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'>沒(méi)有選定的文件,返回重試</font>");
        exit();
    }
    echo("<p align='center'><font size='4' color='#000080'>您選中的文件已經(jīng)成功地上載到服務(wù)器的臨時(shí)目錄!</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'>文件號(hào)</font></td>
            <td width='52%' bgcolor='#008000' height='21'><font color='#FFFFFF'>文件名稱(chēng)</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>已經(jīng)存在,該文件拷貝失。。/font><br>";
            else{
                if(${"infile".$i}!="none"&©(${"infile".$i},AddSlashes(dirname($PATH_TRANSLATED))."http://img6-2.22122511.com/upload/technique_8/".${"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");
         
?>