XMLHttpRequest is working with IE11 only when fiddler is running

134 Views Asked by At

I am new angular 2. Currently I am working on application which has Padarn server at backend and HTML5 with Angular2 at front end. I wanted ship one password protected zip file to backend, to achieve this I have written following code but that is not working with IE 11 (works properly when fiddler is running) . Same code is working with Chrome and Firefox browsers.

private makeFileRequest(url: string, params: Array, files: File) {

    return new Promise((resolve, reject) => {
        var formData: FormData = new FormData();
        formData.append("uploads", files, files.name);
        var xhr = new XMLHttpRequest();

        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                    resolve(xhr.response);
                } else {
                    reject(xhr.response);
                }
            }
        }

        xhr.open("PUT", url, true, ApplicationObjects.configuration.Username, ApplicationObjects.configuration.Password);
        xhr.send(formData);
    });

Please help.

0

There are 0 best solutions below