Although it is now possible to transfer files to the server in a browser by using a form, especially the form control, this thing can only pass one file at a time. If the user needs to upload the entire album or more pictures, then the technical staff had to think of other ways, such as Flash or JS. But now, with the new tags provided by HTML5, we can totally do without the extra stuff. HTML5 provides several new tags for uploading files, such as multiple to support multiple file uploads. Multiple is a bool tag that indicates whether users are allowed to upload multiple files. For example in the latest version of Safari, Chrome, FireFox, ie and opera are supported. As for the rendering of the control, it's all about the browsers themselves. In order to allow users to select multiple files at once, users can use the shift or CTRL or CMD keys to click the file you want to add.
How to use
From a technical point of view, you just need to label the multiple tag in the input control.
Here's the demo code:
07 |
</td> </tr> </tbody> </table> <table> <tbody> <tr> <td style="border: 0;padding: 0;">08</td> <td style="border: 0;padding: 0;"></td> </tr> </tbody> </table> <table> <tbody> <tr> <td style="border: 0;padding: 0;">09</td> <td style="border: 0;padding: 0;">Solution 4-5: Sending multiple files</td> </tr> </tbody> </table> <table> <tbody> <tr> <td style="border: 0;padding: 0;">10</td> <td style="border: 0;padding: 0;"></td> </tr> </tbody> </table> <table> <tbody> <tr> <td style="border: 0;padding: 0;">11</td> <td style="border: 0;padding: 0;"> |
21st |
solution 4-5: Sending multiple files |
23 |
upload one or more files: |
Important Experience
Multiple files selected by the user will be processed by the server's programming language when they are delivered to the server. Some programming languages, such as PHP, require you to add brackets to the character name tag to support the transfer of multiple files.
In this way, PHP constructs an array of data types to hold files uploaded to the server. Instead, if you don't apply square brackets to the HTML tag, PHP will only accept the last file. This article links http://www.cxybl.com/html/wyzz/JavaScript_Ajax/20130717/39137.html