Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

formdata array of objects

const formData = new FormData();
for (let key in form) {
    Array.isArray(form[key])
        ? form[key].forEach(value => formData.append(key + '[]', value))
        : formData.append(key, form[key]) ;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #formdata #array #objects
ADD COMMENT
Topic
Name
8+2 =