Skip to content

[DEPRECATED] Converts json-like object with File, FileList, Blob to FormData object

License

Notifications You must be signed in to change notification settings

nervgh/object-to-formdata

Repository files navigation

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, Object.getPrototypeOf, Array.prototype.forEach, Array.prototype.map, window.FormData

Syntax

// 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);

About

[DEPRECATED] Converts json-like object with File, FileList, Blob to FormData object

Resources

License

Stars

Watchers

Forks

Packages

No packages published