首頁 >後端開發 >php教程 >多文件上載系統完整版_PHP教程

多文件上載系統完整版_PHP教程

WBOY
WBOY原創
2016-07-21 16:10:35799瀏覽

<?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");

$i<=UPLOAD_NO;$i ){
        echo("<input type=file name=infile$i>   ");     }

    echo("<br><br><input type="checkbox" name="overload" value="ON><input type="checkbox" name="overload" value="/><<< <font color='#ff0000'>是否覆寫已存在的檔案? </font>");
    echo("<br><br><input type=submit value=上載><br><input type=submit value=上載><br><input type=submit value=上載>< );
}
else{
    //處理上載
    $noinput = true;
    for($i=1$noinput&($no);
         if(${"infile".$i}!="none") $noinput = false;
    }
  4 ' color='#000080'>沒有選定的文件,回傳重試</font>");
        exit();
    }
 exit();
    }
 font size='4' color='#000080'>您選取的檔案已成功地上載到伺服器的暫存目錄! </font><br>");         
    echo("<table border='1' width='84%' height='52' btable border='1' width='84%' height='52' btable border='1' width='84%' height='52' btable border='1' width='84%' height='52' bbordercolors_#0080800 <tr>
            <td width='14%' bgcolor='#008000' height='21'><font color='#008000' height='21'><font color='#008000' height='21'><font color='00800/        <td width='52%' bgcolor='#008000' height='21'><font color='#FFFFFF'>檔案名稱</font></td>
  '#008000' height='21'><font color='#FFFFFF'>檔案大小</font></td>
        </tr> 1;$i<=UPLOAD_NO;$i ){
        $just=${"infile".$i."_size"};
    if($overload!=ON){
            if(file_exists(AddSlashes(dirname($PATH_TRANSLATED))."upload    echo "< font size='4' color='#ff0000'>您上載的檔案<font color='#000000'>".${"infile".$i."_name"}."</font>已經存在,該文件拷貝失敗!</font><br>";
            else{
        es(dirname( $PATH_TRANSLATED))."/upload/".${"infile".$i."_name"})&&unlink(${"infile".$i})){
          .$i."_name"};
                echo("<tr>
     >$i</td>
                    <td width='5 2 %' height='19'>$str</td>
                    <td@@                  </tr>") ;
                  }
            🎜>            if(${"infile".$i}!="none"&©(${"infile" .$i },增加斜線(dirname($PATH_TRANSLATED))."上傳".${"infile".$i."_name"})&&unlink(${"infile".$i})){
      {"infile ".$i."_name"};
               echo("
      td>
                                       <>                   </tr >”);
            }
        }

    }
             
}

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





http://www.bkjia.com/PHPjc/314186.html

www.bkjia.com
true

http: //www.bkjia.com/PHPjc/314186.htmlTechArticle

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn