Home > Backend Development > PHP Tutorial > Full version of multiple file upload system_PHP tutorial

Full version of multiple file upload system_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 16:10:35
Original
838 people have browsed it

<?php
//Full version of multi-file upload system
//Powerful function, you can arbitrarily control the number of uploaded files, whether to overwrite or not

include("../include/common.inc") ;
$title = "Multiple file upload program";
include("../include/header.inc");

//Define the number of files allowed to be uploaded

define("UPLOAD_NO", 10);

echo("<p align='center'><font size='4' color='#000080'>Welcome!<br>Once Up to ".UPLOAD_NO." files can be uploaded<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"); <font color='#ff0000'>Do you want to overwrite existing files? </font>");
echo("<br><br><input type=submit value=Upload></form>n" );
}
else{
//Process upload
$noinput = true;
for($i=1;$noinput&&($i<=UPLOAD_NO);$i++){
If(${"infile".$i}!="none") $noinput = false;
}
if($noinput){
echo("<font size='4 ' color='#000080'>There is no selected file, return and try again</font>");
   exit(); font size='4' color='#000080'>The file you selected has been successfully uploaded to the temporary directory of the server! </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'>File number</font></td>
<td width='52%' bgcolor='#008000' height='21'><font color='#FFFFFF'>File name</font></td>
    <td width='34%' bgcolor= '#008000' height='21'><font color='#FFFFFF'>File size</font></td>
</tr>");

for($i= 1;$i<=UPLOAD_NO;$i++){
                                                                                                                                               if($overload!=ON){
   if(file_exists(AddSlashes(dirname($PATH_TRANSLATED))."upload".${"infile".$i."_name"}))
    echo "< font size='4' color='#ff0000'>The file you uploaded<font color='#000000'>".${"infile".$i."_name"}."</font> already exists. The file copy failed!</font><br>";
            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>");
                  }
            }
        }
        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");

?>  

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/314186.htmlTechArticle<?php //多文件上载系统完整版 //功能强大,可任意控制上载文件数,是否覆盖 include(../include/common.inc); $title = 多个文件的上载程序; include...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template