I have written this AJAXUpload method in a cshtml file in my C# MVC project:
function AjaxUpload(url, method, data, successFunction, errorFunction, skipErrorDlg) {
    $.ajax({
        contentType: false,
        processData: false,
        url: url,
        data: data,
        type: method,
        dataType: 'json',
        beforeSend: function (xhr) {
            xhr.setRequestHeader('Authorization', GlobalAuthToken);
        },
        success: function (data) {
            successFunction(data);
        },
        error: function (event, jqxhr, settings, thrownError) {
            console.log(thrownError);
        }
    });
}
Here is my HTML file component:
<input type="file" class="file" id="attachment" style="display: none;" onchange="fileSelected(this)" accept=".csv"/>
This is my Javascript from where I am calling this above method:
function fileSelected(input) {
    console.log("Chosen file: " + input.files[0].name);
    var data1 = new FormData();
    data1.append("ImportedFile", input.files[0]); 
    AjaxUpload('/Zetes.ZWS.Processes.Rest/api/importbundles',
        'POST',
        data1,
        function () {
            console.log("Import completed");
        }); 
}
However, I am always getting undefined error while invoking this AJAX.
So, I just tried hit-and-trial method and found out that when I use  processData: false it causes undefined exception.
So, I tried to remove this line too. That gives me Illegal Invocation Exception.
Any suggestions?
 
     
    