1

I send file using XMLHttpRequest and it works "OK" while size of file less 130 kB.

My code is

var xhr = new XMLHttpRequest();

    xhr.upload.onprogress = function(e){
        if (e.lengthComputable){
            self._loaded[id] = e.loaded;
            self._options.onProgress(id, name, e.loaded, e.total);
        }
    };

    xhr.onreadystatechange = function(){            
        if (xhr.readyState == 4){
            self._onComplete(id, xhr);                    
        }
    };

    // build query string
    params = params || {};
    params['qqfile'] = name;
    var queryString = qq.obj2url(params, this._options.action);

    xhr.open("POST", queryString, true);
    xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
    xhr.setRequestHeader("X-File-Name", encodeURIComponent(name));
    xhr.setRequestHeader("Content-Type", "application/octet-stream");
    xhr.send(file);

Can anybody help me?

sagus_helgy
  • 1,417
  • 1
  • 18
  • 30

1 Answers1

0

Problem solved when mod_security(PHP server) has been disabled.

sagus_helgy
  • 1,417
  • 1
  • 18
  • 30