PHP implements multi-file upload, and requires an example of PHP to implement multi-file upload. paste the code directly. thank you.
Reply to discussion (solution)
No one else ....
Baidu swfupload. download an instance and study it.
Uploading multiple files is not just a few pieces of code.
Will a single file be uploaded? If yes, multiple files are the same. Only form controls are named as arrays. php only processes arrays.
$ _ FILES ["file"] how to receive array FILES
Foreach ($ _ FILES ["file"] as $ item)
{
$ S = $ s. ",". $ item;
}
Only one file can be received
What is your html code?
If ($ _ FILES ['file'] ['size']> 0 ){
If ($ _ FILES ["file"] ["error"]> 0 ){
$ Msg = "Attachment Upload error:". $ _ FILES ["file"] ["error"];
} Else {
// If (file_exists ("upload/". $ _ FILES ["file"] ["name"]) {
// Echo $ msg = $ _ FILES ["file"] ["name"]. "The attachment already exists! ";
//} Else {
$ Yc =$ _ POST ['yc'];
$ Yt = $ _ POST ['yt'];
$ Type = $ _ POST ['type'];
$ NewFileName = str_replace (".", "_". time (). ".", $ _ FILES ["file"] ["name"]);
$ Path = "upload/". $ newFileName;
Move_uploaded_file ($ _ FILES ["file"] ["tmp_name"], $ path );
$ SQL = "insert into A004 (c02, c03, c04, c05, c06, c07, c08, c09, c10) values ('". $ id. "','". $ newFileName. "','". $ path. "','". $ yc [0]. "','". $ yt [0]. "','". $ type [0]. "', '0 ','". $ _ SESSION ['login _ id']. "','". get_time (). "')";
$ Msg = $ DB-> Update ($ SQL, "[10016] failed to submit data. please try again later or contact the technician! ");
//}
}
}
JQuery dynamically adds the input type = file upload field