废话不说,代码和效果:
test.uploadAction = new Ext.Button({
text : '导入时刻表信息',
iconCls : 'field',
listeners : {
'click' : function(btn, e) {
new Ext.Window({
width : 650,
title : '导入信息',
height : 300,
layout : 'fit',
modal : true,
items : [ {
xtype : 'SWFUploader',
border : false,
fileSize : 1024 * 550,
uploadUrl : ctx + '/operate/fileupload',
flashUrl : ctx + '/resources/swfupload/swfupload.swf',
filePostName : 'file',
fileTypes : '*.xls',
postParams : {
name : "operate"
},
onUploadSuccess : onUploadSuccess
} ]
}).show();
}
}
});
大家应该注意到了,重点在fileTypes属性上。