ExtJS 多文件上传
来源:互联网 发布:网络arp检测工具 编辑:程序博客网 时间:2024/05/29 10:41
前台实现:
ExtJS MVC 上传文件button响应事件里面的:
//multi file upload 插件var panel = Ext.create('Ext.ux.uploadPanel.UploadPanel', {header : false,addFileBtnText : '选择日志文件...',uploadBtnText : '上传',removeBtnText : '移除所有',cancelBtnText : '取消上传',file_size_limit : 100,// MBwidth : 750,height : 300,flash_url : "swfupload/swfupload.swf",flash9_url : "swfupload/swfupload_fp9.swf",upload_url : path + '/projectmanager/UploadAction.action'});win = Ext.widget('window', {title : '日志文件上传',closeAction : 'destroy',layout : 'fit',resizable : false,modal : true,items : panel});win.show();
后台实现action:
public class UploadAction extends Struts2ActionSupport { private File Filedata; private String FiledataFileName; private String FiledataContentType; //前台用户修改后的文件名 private String newFileName; private String savePath; public String getSavePath() {return savePath;}public void setSavePath(String savePath) {this.savePath = savePath;}public File getFiledata() {return Filedata;}public String getFiledataFileName() {return FiledataFileName;}public String getFiledataContentType() {return FiledataContentType;}public void setFiledata(File filedata) {Filedata = filedata;}public void setFiledataFileName(String filedataFileName) {FiledataFileName = filedataFileName;}public void setFiledataContentType(String filedataContentType) {FiledataContentType = filedataContentType;}//文件读取和日志数据插入到数据库public String fileUpLoad() throws Exception{InputStream is = new FileInputStream(Filedata);String root = ServletActionContext.getServletContext().getRealPath(savePath); File deskFile = new File(root,newFileName);OutputStream os = new FileOutputStream(deskFile);byte[] buffer = new byte[1024];int length = 0;while((length =is.read(buffer))!=-1){os.write(buffer,0,length);}os.close();is.close();HttpServletResponse response = ServletActionContext.getResponse();response.setCharacterEncoding("UTF-8");response.setContentType("text/xml;charset=utf-8");response.getWriter().write("{success:true}");return null;}public String getNewFileName() {return newFileName;}public void setNewFileName(String newFileName) {this.newFileName = newFileName;}}
0 0
- ExtJS 多文件上传
- 【ExtJs】ExtJs的文件上传
- Extjs 文件上传
- extjs 上传文件 fileUpload
- ExtJs + Struts2文件上传
- extjs 上传文件 fileUpload
- extjs 文件上传
- Extjs实现文件上传
- extjs实现文件上传
- Extjs文件上传例子
- Extjs文件上传
- Extjs文件上传
- extjs文件上传
- Extjs 实现文件上传
- extjs文件上传
- extjs的文件上传
- ExtJS:文件上传实例
- 【Extjs】上传文件
- 设计模式
- vim+tags 安装使用
- Netty官方指南: User guide for 4.x
- ajax自动更新订单状态
- DataTable删除重复数据
- ExtJS 多文件上传
- java 泛型编程(一)
- hdoj 1686 Oulipo
- linux驱动设备在多进程打开问题
- iOS 支持多任务、断点下载(图片、音频、视频) (Demo 一)
- NOIP2011 聪明的质监员(二分)
- 倒杨辉三角形
- 2015年8月初iOS 8安装率碾压Android 5.0
- Android 软键盘盖住输入框的问题