Html5 uploading multiple files
The idea is to let xhr know what exactly list item it is dealing with. For example use this code I didn't check if it works. The purpose of this code is to describe the idea :. I think I found a solution for this problem. It looks working on some of my tests. I'm not very good at english thus I'll just share my sample script. If you ask any question, I'll try to explain more :. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Collectives on Stack Overflow. Learn more. Asked 10 years, 6 months ago. Active 4 years, 11 months ago. Viewed 13k times. N West 6, 24 24 silver badges 40 40 bronze badges. Dan L Dan L 4, 3 3 gold badges 34 34 silver badges 70 70 bronze badges. Add a comment. Forum Donate.
Ahmed Bouchefra. What's FormData FormData is simply a data structure that can be used to store key-value pairs. These are the available methods on FormData objects: append : used to append a key-value pair to the object. If the key already exists, the value is appended to the original value for that key, delete : used to deletes a key-value pair, entries : returns an Iterator object that you can use to loop through the list the key value pairs in the object, get : used to return the value for a key.
This is going to relace the value if a key already exists, values : returns an Iterator object for the values of the FormData object. Next, create the index. Next, we query for the file input element using the querySelector method. You can experiment with this example from this code sandbox: Uploading Multiple Files You can easily modify the code above to support multiple file uploading.
If the Uploader is used in a browser with HTML5 support, it is progressively enhanced to enable dragging-and-dropping files into the browser window. Please note: This example will not work when run from a local filesystem because of security restrictions in the transport protocols used. Also note: You will need compile and host your own flashuploader.
Also note: The uploader is not supported on iOS devices iPhone and iPad , because they lack file upload capability.
0コメント