Level 58
To upload files using JavaScript instead of jQuery, you can use the XMLHttpRequest object. Here's an example:
const xhr = new XMLHttpRequest();
const formData = new FormData();
formData.append('file', fileInput.files[0]);
xhr.open('POST', 'My url here');
xhr.send(formData);
In this example, fileInput is a reference to the file input element on the page. You can add additional data to the formData object using the append method.
Note that the contentType and processData options are not needed when using FormData.