Html5.js: How not to rely on JS or flash to use HTML5 to transfer multiple files

Source: Internet
Author: User
Tags add

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:
01
02
03
04
05
06
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;">
12
13
14
15
16
17
18
19
20
21st solution 4-5: Sending multiple files
22
23 upload one or more files:
24
25
26
27
28
29
30
31
32
33
34
35
36
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.
1
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

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.