版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/inforstack/article/details/46638821
width : 510,
labelAlign : 'right',
xtype : 'filefield',
fieldLabel : "文档",
buttonText : "浏览",
formBind : true,
disabled : true,
name : 'sampleDocument',
clearOnSubmit : false,//上传成功不会清空上传框
listeners : {
change : function(btn, value, eOpts) {
if (value != null) {
var form = this.up("form").getForm();
if (form.isValid()) {
form.submit({
waitMsg : "上传中",
url : '/subscriber/sample/document/upload',
params : {
pathName : "sampleDocument"
},
success : function(fp, o) {
if (o.result.success == 1) {
thisPanel.documentId = o.result.data;
} else {
thisPanel.form.findField('sampleDocument').setRawValue('');
}
},
failure : function(fp, o) {
thisPanel.form.findField('sampleDocument').setRawValue('');
Ext.Msg.alert("上传失败", o.result.errorMsg);
}
});
} else {
Ext.Msg.alert("上传失败","上传失败");
}
}
}
}