How to send a file and parameters within the same XMLHttpRequest

JavascriptWeb DevelopmentFront End Scripts

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);
raja
Published on 10-Apr-2018 09:27:52
Advertisements