ftl1012

一键上传

jar包下载

jquery代码

    $(function () {  
                $(".uploadfile").upload({  
                    action: \'CourseXMLFileUploadHander.ashx\',  
                    name: \'xml\',  
                    params: {  
                        \'type\': \'uploadCourseXMLFile\',  
                        \'rand\': Math.random()  
                    },  
                    onSelect: function (self, element) {  
                        this.autoSubmit = false;  
                        var re = new RegExp("(xml){1}quot;, "i");  
      
                        if (!re.test(this.filename())) {  
                            alert("Only xml file can be uploaded");  
                        }  
                        else {  
                            this.submit();  
                        }  
                    },  
                    onSubmit: function (self, element) {  
                        $(\'.uploadfile\').hide();  
                        $(\'#ajax_update\').parent().show();  
                        //alert(\'Uploading file...\');  
                    },  
                    onComplete: function (data, self, element) {  
                        $(\'#ajax_update\').parent().hide();  
                        $(\'.uploadfile\').show();  
                        self.resetInput();  
                        try {  
                            var ret = data;  
                            if (ret.indexOf("exception") >= 0) {  
                                alert(\'Upload file exception: \' + eval(data)[0].exception);  
                            }  
                            else {  
                                showSuccess(\'File is successfully Load.\');  
      
                                uploadSuccess(ret);  
      
                            }  
                        } catch (err) {  
                            alert(data);  
                        }  
                    }  
                });  
            });  

  

分类:

技术点:

相关文章:

  • 2021-06-03
  • 2021-10-25
  • 2021-08-12
  • 2021-10-24
  • 2021-08-26
  • 2022-12-23
猜你喜欢
  • 2021-11-29
  • 2021-11-29
  • 2021-11-29
  • 2021-06-27
  • 2021-11-29
  • 2021-10-16
  • 2021-07-18
相关资源
相似解决方案