[ 如果使用浏览器上传文件,通过抓包的方式查看http协议表头的内容可以知道: 1、在IE、Opera、google浏览器中是不允许上传2G以上的文件,http表头它会把文件的大小标
Extjs有许多extension用于file上传。这里只说下最基本不使用任何extension。
//form构成
var form=new Ext.form.FormPanel({
frame:true,
fileUpload:true;
items:[
{
xtype:"textfield",
fieldLabel:'礼品图片''
[size=large]inputType:"file",[/size]
allowBlank:false,
blankText:'所需积分是必填项',
id:'fldGiftGif'
},
]
});
//异步form提交
form.getForm().submit({
url:url,
success:funtcion(){}
});
Ext实质上是用隐藏的《iframe》模拟了一个ajax文件上传的过程。xmlHttpRequest除了Firefox外,其他浏览器都不支持文件上传。
注意:
1、Extjs Api Ext.form.BasicForm中Config options fileupload的说明
2、在formPanel的ConfigOptions中将fileUpload设置为true。Although they are not listed, Ext.form.FormPanel also accepts all the config options required to configure its internal Ext.form.BasicForm[例子是网上找的,不过是php的 给转成jsp 吧中间遇到的问题说了一下
upfile