被这个文件上传坑到如今。还是自己技术问题,照着之前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 单个文件上传的更多相关文章

  1. spring mvc文件上传(单个文件上传|多个文件上传)

    单个文件上传spring mvc 实现文件上传需要引入两个必须的jar包    1.所需jar包:                commons-fileupload-1.3.1.jar       ...

  2. sruts2:单个文件上传,多个文件上传(属性驱动)

    文件上传功能在Struts2中得到了很好的封装,主要使用fileUpload上传组件. 1. 单个文件上传 1.1 创建上传单个文件的JSP页面.显示提交结果的JSP页面 uploadTest1.js ...

  3. Struts2 单个文件上传/多文件上传

    1导入struts2-blank.war所有jar包:\struts-2.3.4\apps\struts2-blank.war 单个文件上传 upload.jsp <s:form action= ...

  4. SpringMVC:学习笔记(8)——文件上传

    SpringMVC--文件上传 说明: 文件上传的途径 文件上传主要有两种方式: 1.使用Apache Commons FileUpload元件. 2.利用Servlet3.0及其更高版本的内置支持. ...

  5. springboot文件上传: 单个文件上传 和 多个文件上传

    单个文件上传 //文件上传统一处理 @RequestMapping(value = "/upload",method=RequestMethod.POST) @ResponseBo ...

  6. SpringMVC注解方式与文件上传

    目录: springmvc的注解方式 文件上传(上传图片,并显示) 一.注解 在类前面加上@Controller 表示该类是一个控制器在方法handleRequest 前面加上 @RequestMap ...

  7. SSM框架之SpringMVC(5)文件上传

    SpringMVC(5)文件上传 1.实现文件上传的前期准备 1.1.文件上传的必要前提 A form 表单的 enctype 取值必须是: multipart/form-data(默认值是:appl ...

  8. SpringMVC 通过commons-fileupload实现文件上传

    目录 配置 web.xml SpringMVC配置文件 applicationContext.xml 文件上传 Controller 上传实现一 上传实现二 测试 依赖 配置 web.xml < ...

  9. springmvc学习笔记--支持文件上传和阿里云OSS API简介

    前言: Web开发中图片上传的功能很常见, 本篇博客来讲述下springmvc如何实现图片上传的功能. 主要讲述依赖包引入, 配置项, 本地存储和云存储方案(阿里云的OSS服务). 铺垫: 文件上传是 ...

随机推荐

  1. 大型情感类电视连续剧--Android高德之旅(2)地图类型

    总要说两句 今天继续我们的Android高德之旅,上一篇已经能够显示最主要的地图了.有主要的放大缩小功能.还有最后做的点击3D旋转.倾斜视角的效果.今天这篇文章来记录一下高德地图的5种地图类型. (其 ...

  2. 使用 Facebook开源动画库 POP 实现真实衰减动画

    1. POP动画基于底层刷新原理.是基于CADisplayLink,1秒钟运行60秒,接近于游戏开发引擎 @interface ViewController () @property (nonatom ...

  3. ubuntu adb 安装

    ubuntu 下adb 安装,其实就是下载一个adb,然后给它赋予可执行权限,最后在环境变量里添加一下罢了.具体如下 1.下载adb 这个工具其实是在sdk工具包里面的platform-tools文件 ...

  4. VS NuGet使用

    通过这个可以自动联网下载内容! 很方便! 工具->NuGet包管理工具->程序包管理器控制台

  5. elasticsearch index 之 engine

    elasticsearch对于索引中的数据操作如读写get等接口都封装在engine中,同时engine还封装了索引的读写控制,如流量.错误处理等.engine是离lucene最近的一部分. engi ...

  6. 14.字符串hash寻找第一个只出现一次的字符

    //char 0-255一共256个 char getonebyhash(char *str) { if (str == NULL) { return '\0'; } char ch = '\0'; ...

  7. POJ 2458 DFS+判重

    题意: 思路: 搜+判重 嗯搞定 (听说有好多人用7个for写得-.) //By SiriusRen #include <bitset> #include <cstdio>0 ...

  8. js全局的解析与执行过程

    先看下面实例的执行结果: alert(a);//undefined alert(b);//报错 alert(f);//输出f函数字符串 alert(g);//undefined var a = 1; ...

  9. Linear Decoders

    Sparse Autoencoder Recap In the sparse autoencoder, we had 3 layers of neurons: an input layer, a hi ...

  10. eclipse - 下载网址

    这里面有着非常齐全的eclipse相关资源,而且都是放在网盘里面的,下载也方便 http://www.androiddevtools.cn/