Full version of Multifile upload system

Source: Internet
Author: User

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

?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.