<? The full version of the php multi-file upload system is powerful, allowing you to control the number of uploaded files, whether to overwrite include (& quot ;.. includecommon. inc & quot;); $ title & quot; Upload programs for multiple files & quot; include (& quot ;.. includeheader. inc & quot;); definitions allow <? Php
// Full version of multifile Upload system
// Powerful function. you can control the number of uploaded files and check whether the files are overwritten.
Include ("../include/common. inc ");
$ Title = "upload programs for multiple files ";
Include ("../include/header. inc ");
// Defines the number of objects that can be uploaded
Define ("UPLOAD_NO", 10 );
Echo ("<p align = 'center'> <font size = '4' color = '#000080'> Welcome! <Br> A maximum of ". UPLOAD_NO." files can be uploaded at a time <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> <input type =" checkbox "name =" overload "value =" ON "> </font> <font color = '# ff0000'> overwrite existing files? </Font> ");
Echo ("<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'> if no selected file exists, retry is returned. </font> ");
Exit ();
}
Echo ("<p align = 'center'> <font size = '4' color = '#000080'> The selected file has been successfully uploaded to the temporary directory on the server! </Font> <br> ");
Echo ("<table border = '1' width = '000000' height = '52 'bordercolorlight = '# 84% 'bordercolordark =' #008080 '>
<Tr>
<Td width = '000000' bgcolor = '# 000000' height = '21'> <font color =' # ffff'> File Number </font> </td>
<Td width = '000000' bgcolor = '# 000000' height = '21'> <font color =' # ffff'> file name </font> </td>
<Td width = '000000' bgcolor = '# 000000' height = '21'> <font color =' # ffff'> File size </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'> the file you uploaded <font color = '#000000'> ". $ {"infile ". $ I. "_ name "}. "</font> the file already exists. An error occurred while copying the file! </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 = '000000' height = '19'> $ I </td>
<Td width = '000000' height = '19'> $ str </td>
<Td width = '000000' 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 = '000000' height = '19'> $ I </td>
<Td width = '000000' height = '19'> $ str </td>
<Td width = '000000' height = '19'> $ fp_size [I] </td>
</Tr> ");
}
}
}
Echo "</table> ";
}
Include ("../include/footer. inc ");
?>