ExtJs文件上传
2017-01-19 10:05
253 查看
var form = new Ext.form.FormPanel
({
layout:'form',
labelWidth:60,
labelAlign:'right',
fileUpload:true,/////////////////
items:
[{
id:'file',
xtype:'textfield',
fileUpload:true,
fieldLabel:'项目资料',
labelStyle:'margin:0 0 10px 0;',
name: 'uploadFile',
inputType: 'file',
blankText: '请上传文件',
width:170,
}]
});
//新增项目
var addProgram = new Ext.Window
({
title:'项目申报',
layout:'form',
autoHeight:true,
width:350,
frame:true,
//closeAction:'hide',
labelWidth:60,
modal:true,
labelAlign:'right',
items:[form],
buttons:
[{
text:'申报',
handler:function()
{
form.getForm().submit
({
url:pm_papplication_add,
method:'POST',
success:function(resp,obt)
{
Ext.MessageBox.alert("提示信息","申报成功!");
},
failure : function(form, action)
{
Ext.MessageBox.alert("提示信息","申报失败!");
}
});
}
},
{
text:'取消',
handler:function()
{
addProgram.close();
}
}],
buttonAlign:'center'
}).show();
//获取上传文件
public void add(HttpSession session,HttpServletRequest request,HttpServletResponse response,
@RequestParam(value="uploadFile")MultipartFile multipartFile)
{
//存取路径
String path = session.getServletContext().getRealPath("upload/resource/");
//通过MultipartFile存取到服务器中
multipartFile.transferTo(new File(path,multipartFile.getOriginalFilename()));
}
({
layout:'form',
labelWidth:60,
labelAlign:'right',
fileUpload:true,/////////////////
items:
[{
id:'file',
xtype:'textfield',
fileUpload:true,
fieldLabel:'项目资料',
labelStyle:'margin:0 0 10px 0;',
name: 'uploadFile',
inputType: 'file',
blankText: '请上传文件',
width:170,
}]
});
//新增项目
var addProgram = new Ext.Window
({
title:'项目申报',
layout:'form',
autoHeight:true,
width:350,
frame:true,
//closeAction:'hide',
labelWidth:60,
modal:true,
labelAlign:'right',
items:[form],
buttons:
[{
text:'申报',
handler:function()
{
form.getForm().submit
({
url:pm_papplication_add,
method:'POST',
success:function(resp,obt)
{
Ext.MessageBox.alert("提示信息","申报成功!");
},
failure : function(form, action)
{
Ext.MessageBox.alert("提示信息","申报失败!");
}
});
}
},
{
text:'取消',
handler:function()
{
addProgram.close();
}
}],
buttonAlign:'center'
}).show();
//获取上传文件
public void add(HttpSession session,HttpServletRequest request,HttpServletResponse response,
@RequestParam(value="uploadFile")MultipartFile multipartFile)
{
//存取路径
String path = session.getServletContext().getRealPath("upload/resource/");
//通过MultipartFile存取到服务器中
multipartFile.transferTo(new File(path,multipartFile.getOriginalFilename()));
}
相关文章推荐
- extjs文件上传成功后,却弹出了下载框!
- jsp+Extjs实现动态显示文件上传进度
- Extjs 文件上传的实现方法
- ExtJS+SpringMVC文件上传与下载
- Extjs文件上传(JSP处理)的Demo代码
- ExtJS+Jquery实现文件上传
- extjs struts2 文件上传的备忘录
- asp.net mvc + ExtJs 上传文件
- EXTJS文件上传点提交是报如下错误:missing ) in parenthetical
- Extjs 文件的上传(基于struts2)
- Extjs 扩展Htmleditor,支持 图片上传 文件上传 插入flash 插入多媒体 插入层 插入横线等功能
- Extjs 文件上传
- extjs4,spring mvc3上传文件
- Extjs 文件上传和下载
- Extjs 关于文件上传file 框 可输入问题解决
- ExtJS 文件上传 网络资料 1
- ExtJs典型用法之文件上传
- extjs文件上传时报错 missing ) in parenthetical巧解
- Extjs 扩展Htmleditor,支持 图片上传 文件上传 插入flash 插入多媒体 插入层 插入横线等功能(2)
- extjs 上传文件 fileUpload