A FormData polyfill
npm install formdata-polyfill
Meant to be used with babel, closer-compiler or equivalent (since it's written in es6 using class, WeakMap, Iterators,
fd = formxhrxhr // This don't work... Needs to be a native FormData
Another possible solution is to convert the form to a native FormData but then you would lose all the other methods not supported by the original FormData.
fd = formfd // returns a native formData with all the fields
If you wish to monkey patch XHR to make it work out of the box then you have to do it yourself
This lib provides you all the function others don't include
values(), and support of
The reason why Rob--W's version didn't work for me was that it only works in web workers due to FileReaderSync beeing used. I did it with constructing new chunks with the blob constructor instead.
new Blob([string, blob, file, etc])