Search code examples
javascriptangularjsng-file-upload

Ng-file-upload progress bar not working with offlinejs


I'm use ng-file-upload for fileuploading in my home, and the good news is that it's working fine and I'm able to upload files.

The issue is that the progress bar only shows when i disable the offlinejs in index.html. It seems like offlineJS i preventing the progress callback from the post call.

Here is the error messege I get:

Error: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': 'function (xhr) {
          if (!xhr || !(xhr instanceof XMLHttpRequest)) return;
          config.__XHR = xhr;
          if (config.xhrFn) config.xhrFn(xhr);
          xhr.upload.addEventListener('progress', function (e) {
            e.config = config;
            notifyProgress(getNotifyEvent(e));
          }, false);
          //fix for firefox not firing upload progress end, also IE8-9
          xhr.upload.addEventListener('load', function (e) {
            if (e.lengthComputable) {
              e.config = config;
              notifyProgress(getNotifyEvent(e));
            }
          }, false);
        }' is not a valid HTTP header field value.
    at Error (native)
    at XMLHttpRequest.f.setRequestHeader (http://localhost:3000/lib/js/offline/offline.min.js:2:3272)

Solution

  • The issue was fixed in the latest version of ng-file-upload!