Syntax error How to send a file and parameters within the same XMLHttpRequest

How to send a file and parameters within the same XMLHttpRequest



To send a file and parameters within the same XMLHttpRequest:

var myForm = new FormData();

myForm.append('param1', 'demo');
myForm.append('param2', 6767);
myForm.append('myDir', 'public-data');
myForm.append('demofile', file);

xhr.send(myForm);
Updated on: 2020-01-28T10:34:09+05:30

468 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements