XMLHttpRequest仅发送最大大小为130 kB的文件 [英] XMLHttpRequest send only 130 kB max size file

查看:170
本文介绍了XMLHttpRequest仅发送最大大小为130 kB的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用XMLHttpRequest发送文件,并且文件大小小于130 kB时,它可以正常"运行.

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

我的代码是

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);

有人可以帮助我吗?

推荐答案

已禁用mod_security(PHP服务器)的问题已解决.

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

这篇关于XMLHttpRequest仅发送最大大小为130 kB的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆