var uploadfield=new Ext.form.TextField({
fieldLabel: '选择文件',
name:"uploadfile",
inputType:'file',
// id:'importuser_value_text',
cls:'default',
anchor:'70%'
});
var addMeetingForm = new Ext.form.FormPanel({
fileUpload: true,
...
后台代码
InputStream fileSource=request.getInputStream();
System.out.println(request.getContentType());
System.out.println(fileSource.read());
addMeetingForm 提交后
输出
multipart/form-data; boundary=---------------------------4827543632391
-1
为什么获取不到上传的文件流呢?
确定肯定是提交成功的,form中其他参数都可以成功获取
如果用struts的话看struts.multipart.maxSize的配置大小,默认是不超过5M的,
[code="js"]
var form = new Ext.form.FormPanel({
fileUpload: true,
baseCls: 'x-plain',
layout:'form',
url:requrl,
frame:true,
items: [{
xtype: 'textfield',
fieldLabel: '文件名',
name: 'file',
inputType: 'file'//文件类型
}],
buttons: [{
text: '上传',
handler: function() {
form.getForm().submit({
success: function(form, action){
Ext.Msg.alert('信息', '文件上传成功!');
},
failure: function(){
Ext.Msg.alert('错误', '文件上传失败');
}
});
}
}]
});
[/code]
被你过滤掉了吧