被这个文件上传坑到如今。还是自己技术问题,照着之前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. 用C#调用Lua脚本

    用C#调用Lua脚本 一.引言 学习Redis也有一段时间了,感触还是颇多的,但是自己很清楚,路还很长,还要继续.上一篇文章简要的介绍了如何在Linux环境下安装Lua,并介绍了在Linux环境下如何 ...

  2. POJ 3174 暴力枚举

    思路: 暴力枚举三个点 判一判 搞定 (x1*y1=x2*y2) x1.y1.x2.y2为他们两两的差 //By SiriusRen #include <cstdio> using nam ...

  3. vue+mui+html5+ plus开发的混合应用底部导航的显示与隐藏

    1. 模板相关内容(template) <template> <div> <transition :name="transitionName"> ...

  4. ipcalcIP地址计算

    ipcalc命令是一个简单的ip地址计算器,可以完成简单的IP地址计算任务. 语法 ipcalc(选项) 选项 -b:由给定的IP地址和网络掩码计算出广播地址: -h:显示给定UP地址所对应的主机名: ...

  5. Intent调用系统拍照程序,返回图片太小的问题

    之前採用的方式(返回的照片会被压缩,不能达到预期效果): Intent intent = new Intent(); Intent intent_camera = getPackageManager( ...

  6. 用 cctld工具创建带有国家代码的IP地址表

    用 cctld工具创建带有国家代码的IP地址表 cctld tools is creating IP addresses table with Country Code 项目地址 https://gi ...

  7. ubuntu-文件管理、编辑

    1.创建单层文件夹 mkdir test 如果你想要创建多层文件夹,这时候你需要添加一个参数-p mkdir -p t1/t2/t3 如果你不加-p的话,它会提示说找不到目录 2.分屏查看内容 mor ...

  8. JS 图片大小自动调整 (img)

    <script> function dlutChangeImg(){ var maxwidth = 598; var obj = document.getElementById('bbs_ ...

  9. mahout历史(二)

    mahout历史 Apache Mahout起源于2008年,经过两年的发展,2010年4月ApacheMahout最终成为了Apache的顶级项目.Mahout 项目是由 ApacheLucene( ...

  10. Emmet学习教程

    Emmet (前身为 Zen Coding) 是一个能大幅度提高前端开发效率的一个工具,Emmet是很成熟的并且非常适用于编写HTML/XML 和 CSS 代码的前端开发人员,但也可以用于编程语言.所 ...