日期:2014-05-16 浏览次数:20762 次
var form =Ext.create('Ext.form.Panel', {
			id:'image_up',
			frame : true,
			buttonAlign : 'center',
			fileUpload: true,  //上传文件
			scope : this,
			 renderTo:Ext.getBody(),
			items : [
				{
					fieldLabel : '上传图片',
					labelAlign:'right',
					name : 'imgFile',
					id : 'imgFile',
					xtype : 'filefield',
					labelWidth : 60,
					archor:'100%',
					width:350,
					height:25,
					buttonText:'选择图片……',
					colspan:2
				}],
				buttons : [ {
					text : '提交',
					handler : function() {
							form.form.submit({
								clientValidation : true,
								url : 'TestUpload',
								method : 'POST',
								waitMsg:'正在上传图片',
								success : function(form, action) {
									var data = Ext.JSON.decode(action.response.responseText).data;
									Ext.Msg.alert('提示', '添加成功');
									window.close();
								},
								failure : function() {
									var data = Ext.JSON.decode(action.response.responseText);
									Ext.Msg.alert('提示', data.errors);
								}
							});
					}
				}, {
					text : '重置',
					handler : function() {
						reset(form);
					}
				} ]
			});
	});