Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nervgh/object-to-formdata
[DEPRECATED] Converts json-like object with File, FileList, Blob to FormData object
https://github.com/nervgh/object-to-formdata
Last synced: about 1 month ago
JSON representation
[DEPRECATED] Converts json-like object with File, FileList, Blob to FormData object
- Host: GitHub
- URL: https://github.com/nervgh/object-to-formdata
- Owner: nervgh
- License: mit
- Created: 2014-12-13T13:40:45.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-29T21:31:21.000Z (over 8 years ago)
- Last Synced: 2024-10-05T01:14:08.234Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 14
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
README
# Object.toFormData()
## Deprecated
See https://github.com/nervgh/recursive-iterator/wiki/Cookbook-(es6)#to-form-data## About
Converts json-like object with `[File]`, `[FileList]`, `[Blob]` to `[FormData]` object## Required
[Object.traverse](https://github.com/nervgh/object-traverse), Object.getPrototypeOf, Array.prototype.forEach, Array.prototype.map, window.FormData## Syntax
```js
// convert object to [FormData]
var form = Object.toFormData(object /*{Object|Array}*/);// send this object
var xhr = new XMLHttpRequest();
xhr.open('POST', '/');
xhr.onload = function() {
alert(xhr.responseText);
};
xhr.send(form);
```