日期:2014-05-16  浏览次数:20350 次

ExtJS文件上传
            <script type="text/javascript">
                Ext.onReady(function(){  
                        var fpFileUpload=new Ext.FormPanel({  
                            id:'fpFileUpload',  
                            frame:true,  
                            fileUpload:true,  
                            items:[  
                                {  
                                    xtype:'textfield',  
                                    allowBlank:false,  
                                    fieldLabel:'选择文件',  
                                    inputType:'file',  
                                    name:'fileName'  
                                }  
                            ],  
                            buttonAlign:'center',  
                            buttons:[  
                                {  
                                    text:'上传',  
                                    handler:function(){  
                                        if(fpFileUpload.form.isValid()){  
                                            fpFileUpload.form.submit({  
                                                method:'post',  
                                                url:'Default.aspx',  
                                                waitMsg:'文件上传中...',  
                                                success: function() {  
                                                    Ext.Msg.alert("系统提示", "文件上传成功!");  
                                                },  
                                                failure: function() {  
                                                    Ext.Msg.alert("系统提示", "文件上传失败!");  
                                                }  
                                            });  
                                        }else{  
                                            Ext.Msg.alert("系统提示","请选择文件后再上传!");  
                                        }  
                                    }  
                                },  
                                {  
                                    text:'取消',  
                                    handler:function(){  
                                        winFielUpload.hide();  
                                    }  
                                }  
                            ]  
                        });  
                        var winFielUpload=new Ext.Window({  
                            id:'win',  
                            title:'文件上传',             
                            width:350,  
                            height:100,  
                            layout:'fit',  
                            autoDestory:true,  
                            modal:true,  
                            closeAction:'hide',  
                            items:[  
                                fpFileUpload  
                            ]  
                        });  
                        window.winFielUpload=winFielUpload;  
                      
                });  
                function showWindow(){  
                        winFielUpload.show();  
                }  
              
         </script>  
?