Input box to upload multiple files

Source: Internet
Author: User
<span id="Label3"></p> <ol> <ol> <li>By adding the multiple attribute to the input tag, you can select multiple files in one input box to upload</li> </ol> </ol><pre><pre><code>multiple="multiple"</code>/><br>Of course, This is the same:</pre></pre><pre><pre><code>multiple</code>/></pre></pre><p><p>2. Many times when uploading, we have to limit the upload file type (</p></p><pre><pre>In windows, the main limitation is the suffix name</pre></pre><pre><pre>), or the selected file name (path) to the current page, <br> which requires JS to obtain the name of the selected File: <br> <br> <span style="color: #ff0000;" document.getelementbyid ("input"). files[i].name < span> <br> <br> 3. Background receive, Java depends on the framework used, Struts should only need to change the corresponding member variable to the group of OK (speculation), <br> Older projects, may not reference the framework, or the framework does not consider this part, you need to modify the file upload code, here <br> only one of the cases (i encountered). <br> <br> <span style="color: #ff0000;"> <strong> The stream received in the background is placed in a map, but when put, the map key uses the Label's name property, which causes </strong> </span> <br> <strong> <span style="color: #ff0000;"> The selected files can only be attached to a single file (the key value in the map cannot be duplicated, and the previous put is overwritten by the subsequent one). </span> </strong> <br> <br> This can be used to upload the file is the famous map of the key value, which will affect the other modules, mainly in the map of the key changes, the other module <br> when the flow is obtained, It may not be possible (there is a big difference between the sign and the file name). <br> My approach is to bury a hidden on the page, use JS to populate the name of the uploaded file (note that there are multiple), so that the background can get the name of the uploaded file, <br> and then there is nothing to do with me <br> <br> <br> <br> with a demo: </span></pre></pre><p><p><! DOCTYPE html><br>

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.