Ext.onReady(function(){

var fileForm = new Ext.form.FormPanel({   
title : "图片",   
renderTo : "fileUpload",   
fileUpload : true,   
layout : "form",   
id : "fileUploadForm",   
name : "上传",
items : [{  
xtype : 'textfield',
id : 'upload',   
name : 'upload',   
inputType : "file",   
fieldLabel : '上传图片',   
xtype : 'textfield',   
anchor : '40%'  
     }, {      
       xtype : 'box',   
       id : 'browseImage',   
       fieldLabel : "预览图片",   
       autoEl : {   
       width : 500,   
       height : 350,   
       tag : 'img',   
       type : 'image',   
       src : Ext.BLANK_IMAGE_URL,   
       style : 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);',   
       complete : 'off',   
       id : 'imageBrowse'  
     }   
     }],        //form事件          listeners : {   
       'render' : function(f) {   
        this.form.findField('upload').on('render', function() {   
      //通過change事件,图片也动态跟踪选择的图片变化   
       Ext.get('upload').on('change',function(field, newValue, oldValue) {   
         //得到选择的图片路径   
        var url = 'file://' + Ext.get('upload').dom.value;   
        alert("url = " + url);   
        //是否是规定的图片类型   
        if (img_reg.test(url)) {  
         //判断是否为IE
         alert("格式OK");
         if (Ext.isIE) {  
          alert("IE");
          var image = Ext.get('imageBrowse').dom;   
          image.src = Ext.BLANK_IMAGE_URL;// 覆盖原来的图片   
          image.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = url;   
         }// 支持FF   
         else {   
           Ext.get('imageBrowse').dom.src = Ext.get('upload').dom.files.item(0).getAsDataURL()   
         }   
        }   
        }, this);   
     }, this);   
   }   
  },      buttons : [{   
     text : "提交",   
      name : "submit",   
      handler : submit   
     }] 
  });     // 上传图片类型   
    var img_reg = /\.([jJ][pP][gG]){1}$|\.([jJ][pP][eE][gG]){1}$|\.([gG][iI][fF]){1}$|\.([pP][nN][gG]){1}$|\.([bB][mM][pP]){1}$/   
   function submit() { 
 
   Ext.getCmp("fileUploadForm").getForm().submit({   
  
     url : 'pic.action',   
     method : "POST",   
     success : function(form, action) {   
        alert("success");   
     },   
    failure : function(form, action) {   
      alert("failure");   
     }   
    });
 }
 
 
 });   上面的代码是一个图片上传和预览的功能,使用的是ExtJS,但是在submit的时候就是无法提交到
action中,显示为语法错误~
看了很久都没发现是哪里有问题~