- From: Joshua Bell <notifications@github.com>
- Date: Thu, 02 Mar 2017 11:38:23 -0800
- To: w3c/FileAPI <FileAPI@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 2 March 2017 19:39:48 UTC
Note that this can be done using the [FormData](https://xhr.spec.whatwg.org/#interface-formdata) interface. Given a form such as:
```html
<form id=f>
<input name=fs type=files multiple>
</form>
```
* Create a FormData populated with the form:
`fd = new FormData(document.getElementById('f'))`
* Get an array of the files:
`files = fd.getAll('fs')`
* Remove from the FormData:
`fs.delete('fs')`
* Filter the files:
`files = files.filter(file => ...)`
* Assign back to the FormData:
`files.forEach(file => fd.append('fs', file))`
* Submit the FormData via [fetch](https://fetch.spec.whatwg.org/) or [XHR](https://xhr.spec.whatwg.org)
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/FileAPI/issues/25#issuecomment-283756829
Received on Thursday, 2 March 2017 19:39:48 UTC