日期:2014-05-16 浏览次数:20545 次
Ext.onReady(function(){ Ext.QuickTips.init(); var msg = function(title, msg){ Ext.Msg.show({ title: title, msg: msg, minWidth: 200, modal: true, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }; var fp = new Ext.FormPanel({ renderTo: 'fi-form', fileUpload: true, width: 500, frame: true, title: 'File Upload Form', autoHeight: true, bodyStyle: 'padding: 10px 10px 0 10px;', labelWidth: 50, defaults: { anchor: '95%', msgTarget: 'side' }, items: [{ xtype: 'textfield', fieldLabel: 'Name', name:"common.name", id:"fileName" },{ xtype: 'fileuploadfield', id: 'formFile', emptyText: 'Select an image', fieldLabel: 'Photo', name: 'common.fileStr', fileUpload : true, buttonText: '', buttonCfg: { iconCls: 'upload-icon' } }], buttons: [{ text: 'Save', handler: function(){ var v = Ext.getCmp('formFile').getValue(); alert(v); if(fp.getForm().isValid()){ fp.getForm().submit({ url: "/common/common_fileLoad.action", method:'POST', waitMsg: 'Uploading your photo...', success: function(fp, o){ msg('Success', 'Processed file "'+o.result.file+'" on the server'); } }); } } },{ text: 'Reset', handler: function(){ fp.getForm().getEl().dom.reset(); } }] }); });