<? 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 of multiple filesProgram";
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 ("
overwrite existing files? ");
echo ("
N ");
}< br> else {
// process upload
$ noinput = true;
for ($ I = 1; $ noinput & ($ I <= upload_no); $ I ++) {
if ($ {"infile ". $ I }! = "NONE") $ noinput = false;
}< br> if ($ noinput) {
echo (" if no selected file exists, Retry is returned ");
exit ();
}< br> echo ("
the selected file has been uploaded successfully. to the temporary directory on the server!
");
echo ("
file number |
file name |
file size |
");
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 ");
?>