解决方法
在Windows里面的MySQL路径里找到my.ini文件
在[mysqld]下面加入如下语句即可
max_allowed_packet = 20M
-----------------------------------------
重启myqsl
对于我个人项目中,upload.html的改写
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<link href="../../../lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="../../../lib/dhtmlx/dhtmlx.css" rel="stylesheet" type="text/css" />
<script src="../../../lib/ligerUI/js/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="../../../lib/dhtmlx/dhtmlx.js" type="text/javascript"></script>
<script src="../../../lib/ajaxfileupload.js" type="text/javascript"></script>
<script src="../../../lib/ligerUI/js/ligerui.all-1.2.5.js" type="text/javascript"></script>
<body>
<div id="loading">
<div class="l-window-mask"></div>
<div class="l-grid-loading">加载中...</div>
</div>
<form id="realForm" method="POST" enctype="multipart/form-data">
<div id="myForm">
</div>
</form>
<div class="l-clear"></div>
<div id="maingrid" style="margin-top: 20px"></div>
<div>
<ul>
<li>(1).上传文件的格式为zip</li>
</ul>
</div>
</body>
<script type="text/javascript">
var myForm, formData;
var dialog;
$(function(){
formData = [
/*{type: "fieldset", label: "基本信息", list:[
{type: "input", name : "version", label: "配置版本",labelWidth: "auto", position: "label-left", inputWidth: 330, labelWidth : 120},
{type: "input", name : "desc", label: "描述信息",labelWidth: "auto", position: "label-left", inputWidth: 330, labelWidth :120 },
{type: "file", name: "files", label: "配置文件", position:"label-left",inputWidth: 330,labelWidth :120,validate: "NotEmpty", required:true}
]},
*/
{type: "fieldset", label: "配置文件", list:[
{type: "input", label: "配置版本",labelWidth: "auto", position: "label-left", inputWidth: 330},
{type: "input", label: "描述信息",labelWidth: "auto", position: "label-left", inputWidth: 330},
{type: "upload", name: "myFiles", inputWidth: 330, inputHeight: 160, url: "upload.upload", titleScreen: true, titleText : "将文件拖拽到此区域或者点击右方的按钮进行上传"}
]},
{type: "button", value: "提交", name: "send"}
];
myForm = new dhtmlXForm("myForm", formData);
myForm.attachEvent("onButtonClick", function(id){
if (id == "send" && myForm.validate()){
//document.getElementById("realForm").submit();
ajaxFileUpload();
}
});
$(":input[name='files']").attr("accept", ".zip");
dialog = frameElement.dialog;
});
function ajaxFileUpload()
{
$("#loading").ajaxStart(function(){
$(this).show();
}).ajaxComplete(function(){
$(this).hide();
});
$.ajaxFileUpload({
url:'upload.upload?cmd=upload_config&opr=insert',
secureuri:false,
fileElementId:'files',
dataType: 'json',
data:{type:'configs', version : myForm.getItemValue("version"), desc : myForm.getItemValue("desc") },
success: function (data, status){
if(data.retCode == 0){
$.ligerDialog.success("上传成功。");
dialog.close();
}
else if(data.retCode == ){0x3000
$.ligerDialog.error(data.retMsg);
}
else{
$.ligerDialog.error("处理失败。");
}
},
error: function (data, status, e){
$.ligerDialog.error(e);
}
}
)
return false;
}
</script>
</html>