Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 636 Bytes

README.md

File metadata and controls

24 lines (19 loc) · 636 Bytes

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