PHP instance: use PHP to implement the multi-file upload system program // define the number of files to be uploaded // The full version of the multi-file upload system // failed to process the upload copy
PHP instance: use PHP to implement multi-file upload system programs
// Full version of multifile Upload system
Include ('../include/common. inc ');
$ Title = 'upload programs for multiple Files ';
Include ('../include/header. inc ');
// Define the number of objects to be uploaded
Define ('upload _ no', 10 );
Echo ('
Welcome!
You can upload up to '. UPLOAD_NO.' files at a time.
N ');
If ($ REQUEST_METHOD! = 'Post '){
Echo ('N ');
}
Else {
// Process Upload
$ Noinput = true;
For ($ I = 1; $ noinput & ($ I <= UPLOAD_NO); $ I ){
If ($ {'file'. $ I }! = 'None') $ noinput = false;
}
If ($ noinput ){
Echo ('No selected file, return retry ');
Exit ();
}
Echo ('
The selected file has been successfully uploaded to the temporary directory on the server!
');
Echo ('
For ($ I = 1; $ I <= UPLOAD_NO; $ I ){
$ Just =$ {'file'. $ I. '_ size '};
$ Fp_size [I] = $ just;
If ($ overload! = ON ){
If (file_exists (AddSlashes (dirname ($ PATH_TRANSLATED). '\ upload \'. $ {'file'. $ I. '_ name '}))
Echo 'file you uploaded '. $ {'infile'. $ I.' _ name'}. 'already exists. An error occurred while copying the file!
';
Else {
If ($ {'file'. $ I }! = 'None '&©($ {'File '. $ I}, AddSlashes (dirname ($ PATH_TRANSLATED )). '/upload /'. $ {'file '. $ I. '_ name'}) & unlink ($ {'infile '. $ I })){
$ Str =$ {'file'. $ I. '_ name '};
Echo ('
$ Str =$ {'file'. $ I. '_ name '};
Echo ('
}
Echo'
File number |
File name |
File size |
');
$ I |
$ Str |
$ Fp_size [I] |
');}}}Else {If ($ {'file'. $ I }! = 'None '&©($ {'File '. $ I}, AddSlashes (dirname ($ PATH_TRANSLATED )). 'upload '. $ {'file '. $ I. '_ name'}) & unlink ($ {'infile '. $ I })){
$ I |
$ Str |
$ Fp_size [I] |
');}}
';
}
Include ('../include/footer. inc ');
?>