ExtJS 中檔案上傳控制項

來源:互聯網
上載者:User

標籤:des   style   blog   color   使用   os   

 1 Ext.onReady(function(){ 2     var fileUpload = new Ext.FormPanel({  3         id:‘fileUpload‘, 4         frame:true, 5         fileUpload:true, 6         items:[{ 7                     xtype:‘textfield‘, 8                     labelStyle : ‘text-align:right;‘, 9                     allowBlank:false,10                     fieldLabel:‘選擇檔案‘,11                     inputType:‘file‘,12                     name:‘fileName‘,13                     width:20014                 }15           ],16           buttonAlign:‘center‘,17           buttons:[{18                   text:‘上傳‘,19                 handler:function(){20                         if(fileUpload.form.isValid()){21                             fileUpload.form.submit({22                                 method:‘post‘,23                                 url:‘DefaultUrl‘,//根據自己系統的需要調用程式處理上傳檔案24                                 waitMsg:‘檔案上傳中...‘,25                                 success: function() {26                                     Ext.Msg.alert("系統提示", "檔案上傳成功!");27                                 },28                                 failure: function() {29                                     Ext.Msg.alert("系統提示", "檔案上傳失敗!");30                                 }31                             });32                         }else{33                             Ext.Msg.alert("系統提示","請選擇檔案後再上傳!");34                         }35                     }36                 },{37                     text:‘取消‘,38                     handler:function(){39                         winFielUpload.hide();40                     }41                 }42          ]43     });44     var winFielUpload=new Ext.Window({45         id:‘win‘,46         title:‘檔案上傳‘,47         //****renderTo:‘divWindow‘,//對於window不要使用renderTo屬性,只需要調用show方法就可以顯示,添加此屬性會難以控制其位置48         width:350,49         closeAction:‘hide‘,//close預設的動作是從DOM樹中移除window並徹底加以銷毀, hide隱藏50         height:105,51         layout:‘fit‘,52         autoDestory:true,53         modal:true,54         closeAction:‘hide‘,55         items:[56             fileUpload57         ]58     }).show();59 });

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.