webx3文件上传
来源:互联网 发布:合肥飞友网络招聘 编辑:程序博客网 时间:2024/05/19 02:40
一、定义form
<form method="post" name="import_form" id="import_form" enctype="multipart/form-data"> <table class="table table-condensed"> $csrfToken.hiddenField <tr> <td> 文件 </td> <td> <input type="file" class="form-control" id="import_file" name="import_file"/> </td> </tr> <tr> <td><input type="hidden" name="action" value="importFaultAction"/></td> <td><input type="submit" id="import_confirm" name="import_confirm" value="上传"/></td> </tr> </table> </form>
二、配置webx.xml文件
Upload服务的配置参数
<services:upload sizeMax="300M" fileSizeMax="200M" repository="/tmp" sizeThreshold="1M"/>
配置过滤参数
<services:request-contexts> <request-contexts:parser URIEncoding="UTF-8" useBodyEncodingForURI="false" > <request-contexts:filters xmlns="http://www.alibaba.com/schema/services/request-contexts/parser/filters"> <!-- 文件上传白名单 --> <uploaded-file-whitelist extensions="xls" /> </request-contexts:filters> </request-contexts:parser></services:request-contexts>
上面的配置将会禁止文件名后缀不在列表中的文件被上传到服务器上。如果做得更好一点,你甚至可以对上传文件进行病毒扫描。
编写Java文件
public class ImportFaultAction { public void execute( TurbineRunData rundata, Context context) throws IOException, ServletException { FileItem file = rundata.getParameters().getFileItem("import_file"); //该文件为上传的文件 //InputStream in = file.getInputStream(); }}
PS:具体请参考 http://www.openwebx.org/docs/Webx3_Guide_Book.html#d0e7262
Webx框架指南: http://www.openwebx.org/docs/Webx3_Guide_Book.html
转自:http://www.hollischuang.com/archives/507
0 0
- webx3文件上传
- 使用jquery-fileupload.js实现文件上传-webx3
- Webx3.1.1
- webx3 mvc
- webx3知识点链接整理
- Webx3原理分析
- Webx3 FrameWork 教程
- Webx3原理分析
- 文件上传---文件上传
- 漫步webx3--webx3学习记录之框架初始化
- Webx3日志系统的配置
- webx3快速创建sample应用
- 上传文件
- 文件上传
- 上传文件
- 文件上传
- 文件上传
- 上传文件
- Dirichlet energy and the Laplace equation
- E
- 第三周项目三-输出星号图(4)
- Analyzing UI Performance with Systrace
- 关于[Ljava.lang.String;@1ec4536的问题
- webx3文件上传
- 项目7-输出星号图
- CreateProcess和WinExec
- boa.conf 详解
- codeforces598A(快速幂)
- WKWebView与js交互
- java.io.Serializable浅析
- get post mysql存储引擎
- 电商数据分析基础指标体系