springMVC easyUI filebox 单个文件上传
被这个文件上传坑到如今。还是自己技术问题,照着之前extjs项目那边的上传实例,愣是上传不了
到后面就查了下springMVC的文件上传,依照那样搞定了http://blog.csdn.net/jadyer/article/details/7575934
easyui 前端文件
<form id="brandAddForm" method="post" enctype="multipart/form-data">
<table cellpadding="5">
<tr>
<td>名称:</td>
<td><input class="easyui-textbox" type="text" name="name" data-options="required:true" style="width:200px"></input></td>
</tr>
<tr>
<td>描写叙述:</td>
<td><input class="easyui-textbox" name="description" data-options="multiline:true" style="height:100px;width:200px"></input></td>
</tr>
<tr>
<td>URL:</td>
<td><input class="easyui-textbox" name="url" style="width:200px"></td>
</tr>
<tr>
<td>LOGO:</td>
<td><input class="easyui-filebox" name="sourceFile" style="width:200px"></td>
</tr>
<tr>
<td>关键词:</td>
<td><input class="easyui-textbox" type="text" name="keywords" data-options="" style="width:200px"></input></td>
</tr>
</table> </form>
springMVC 配置文件
<!-- SpringMVC上传文件时,须要配置MultipartResolver处理器 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="defaultEncoding" value="UTF-8"/>
<!-- 指定所上传文件的总大小不能超过200KB。注意maxUploadSize属性的限制不是针对单个文件。而是全部文件的容量之和 -->
<property name="maxUploadSize" value="200000"/>
</bean> <!-- SpringMVC在超出上传文件限制时。会抛出org.springframework.web.multipart.MaxUploadSizeExceededException -->
<!-- 该异常是SpringMVC在检查上传的文件信息时抛出来的。并且此时还没有进入到Controller方法中 -->
<bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<props>
<!-- 遇到MaxUploadSizeExceededException异常时。自己主动跳转到/WEB-INF/jsp/error_fileupload.jsp页面 -->
<prop key="org.springframework.web.multipart.MaxUploadSizeExceededException">error_fileupload</prop>
</props>
</property>
</bean>
model
public class BrandModel {
private Integer id;
private String name;
private String description;
private String url;
private String icon;
private MultipartFile sourceFile; //相应<span style="font-family: Arial, Helvetica, sans-serif;"><input class="easyui-filebox" name="sourceFile" style="width:200px"></span>
//set/get
}
service 拷贝到你自己的文件夹
FileUtils.copyInputStreamToFile(brandModel.getSourceFile().getInputStream(), new File(targetPath));
springMVC easyUI filebox 单个文件上传的更多相关文章
- spring mvc文件上传(单个文件上传|多个文件上传)
单个文件上传spring mvc 实现文件上传需要引入两个必须的jar包 1.所需jar包: commons-fileupload-1.3.1.jar ...
- sruts2:单个文件上传,多个文件上传(属性驱动)
文件上传功能在Struts2中得到了很好的封装,主要使用fileUpload上传组件. 1. 单个文件上传 1.1 创建上传单个文件的JSP页面.显示提交结果的JSP页面 uploadTest1.js ...
- Struts2 单个文件上传/多文件上传
1导入struts2-blank.war所有jar包:\struts-2.3.4\apps\struts2-blank.war 单个文件上传 upload.jsp <s:form action= ...
- SpringMVC:学习笔记(8)——文件上传
SpringMVC--文件上传 说明: 文件上传的途径 文件上传主要有两种方式: 1.使用Apache Commons FileUpload元件. 2.利用Servlet3.0及其更高版本的内置支持. ...
- springboot文件上传: 单个文件上传 和 多个文件上传
单个文件上传 //文件上传统一处理 @RequestMapping(value = "/upload",method=RequestMethod.POST) @ResponseBo ...
- SpringMVC注解方式与文件上传
目录: springmvc的注解方式 文件上传(上传图片,并显示) 一.注解 在类前面加上@Controller 表示该类是一个控制器在方法handleRequest 前面加上 @RequestMap ...
- SSM框架之SpringMVC(5)文件上传
SpringMVC(5)文件上传 1.实现文件上传的前期准备 1.1.文件上传的必要前提 A form 表单的 enctype 取值必须是: multipart/form-data(默认值是:appl ...
- SpringMVC 通过commons-fileupload实现文件上传
目录 配置 web.xml SpringMVC配置文件 applicationContext.xml 文件上传 Controller 上传实现一 上传实现二 测试 依赖 配置 web.xml < ...
- springmvc学习笔记--支持文件上传和阿里云OSS API简介
前言: Web开发中图片上传的功能很常见, 本篇博客来讲述下springmvc如何实现图片上传的功能. 主要讲述依赖包引入, 配置项, 本地存储和云存储方案(阿里云的OSS服务). 铺垫: 文件上传是 ...
随机推荐
- [ Javascript ] JavaScript中的定时器(Timer) 是怎样工作的!
作为入门者来说.了解JavaScript中timer的工作方式是非常重要的.通常它们的表现行为并非那么地直观,而这是由于它们都处在一个单一线程中.让我们先来看一看三个用来创建以及操作timer的函数. ...
- 如日中天的Uber到底是用什么开发语言做到的?
Uber将正在蓬勃发展的Go和Node.js这两个语言很好的融合到其系统上面来.Uber的站点可靠性project师Tom Croucher在近期于波兰举行的Node.js互动大会上详尽的对该公司所用 ...
- jquery05 继承
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- EF搭建数据库
http://blog.csdn.net/mss359681091/article/details/52135867http://blog.csdn.net/x_craft/article/detai ...
- JavaScript--数据结构与算法之图
图和图的算法:图的定义:由边的集合及顶点的集合组成. 例如地图,每个城镇是顶点,道路是边,由顶点对来定义(城镇1,城镇2)简称(v1,v2)顶点也有权重——成本.基本概念: 有向图:图的顶点对是有序的 ...
- NYOJ 927 The partial sum problem 【DFS】+【剪枝】
The partial sum problem 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描写叙述 One day,Tom's girlfriend give him a ...
- Chrome不能在网易网盘中上传文件的解决办法
Chrome不能在网易网盘中上传文件的解决办法1. 安装 Adobe Flash Player PPAPI,设置flash插件 chrome://settings/content/flash,许可[* ...
- ::的类名前有个 & ,什么意思?
转载自 http://www.imooc.com/qadetail/93985 MazePerson &MazePerson::setPersonPosition(int coordinat ...
- 在Qt Creator的项目中添加头文件和库
在Qt Creator中的工程中,工程通过.pro文件管理. 额外需要连接的连接库unix:LIBS += -L your_lib_path -lyour_libwin32:LIBS += your_ ...
- ORA-16047: DGID mismatch between destination setting and standby
主库有报错如下: ORA-16047: DGID mismatch between destination setting and standby 原因:主库参数设置错误,检查下列参数:log_arc ...